Fix for Network error attempting to view events without permissions (#31920)
* Fix for #31918 Signed-off-by: kaustubh B <kbawanka@redhat.com> * Update js/apps/admin-ui/src/realm-settings/RealmSettingsTabs.tsx Co-authored-by: Stan Silvert <ssilvert@redhat.com> Signed-off-by: kaustubh-rh <88367583+kaustubh-rh@users.noreply.github.com> --------- Signed-off-by: kaustubh B <kbawanka@redhat.com> Signed-off-by: kaustubh-rh <88367583+kaustubh-rh@users.noreply.github.com> Co-authored-by: Stan Silvert <ssilvert@redhat.com>
This commit is contained in:
parent
c0a51b94ea
commit
e090b0d260
1 changed files with 12 additions and 7 deletions
|
@ -288,6 +288,9 @@ export const RealmSettingsTabs = () => {
|
||||||
const clientPoliciesTab = useTab("client-policies");
|
const clientPoliciesTab = useTab("client-policies");
|
||||||
const userProfileTab = useTab("user-profile");
|
const userProfileTab = useTab("user-profile");
|
||||||
const userRegistrationTab = useTab("user-registration");
|
const userRegistrationTab = useTab("user-registration");
|
||||||
|
const { hasAccess, hasSomeAccess } = useAccess();
|
||||||
|
const canViewOrManageEvents =
|
||||||
|
hasAccess("view-realm") && hasSomeAccess("view-events", "manage-events");
|
||||||
|
|
||||||
const useClientPoliciesTab = (tab: ClientPoliciesTab) =>
|
const useClientPoliciesTab = (tab: ClientPoliciesTab) =>
|
||||||
useRoutableTab(
|
useRoutableTab(
|
||||||
|
@ -361,6 +364,7 @@ export const RealmSettingsTabs = () => {
|
||||||
>
|
>
|
||||||
<KeysTab />
|
<KeysTab />
|
||||||
</Tab>
|
</Tab>
|
||||||
|
{canViewOrManageEvents && (
|
||||||
<Tab
|
<Tab
|
||||||
title={<TabTitleText>{t("events")}</TabTitleText>}
|
title={<TabTitleText>{t("events")}</TabTitleText>}
|
||||||
data-testid="rs-realm-events-tab"
|
data-testid="rs-realm-events-tab"
|
||||||
|
@ -368,6 +372,7 @@ export const RealmSettingsTabs = () => {
|
||||||
>
|
>
|
||||||
<EventsTab realm={realm!} />
|
<EventsTab realm={realm!} />
|
||||||
</Tab>
|
</Tab>
|
||||||
|
)}
|
||||||
<Tab
|
<Tab
|
||||||
title={<TabTitleText>{t("localization")}</TabTitleText>}
|
title={<TabTitleText>{t("localization")}</TabTitleText>}
|
||||||
data-testid="rs-localization-tab"
|
data-testid="rs-localization-tab"
|
||||||
|
|
Loading…
Reference in a new issue