From e090b0d26035af69def569410e60dac58ea845f0 Mon Sep 17 00:00:00 2001 From: kaustubh-rh <88367583+kaustubh-rh@users.noreply.github.com> Date: Wed, 7 Aug 2024 23:48:04 +0530 Subject: [PATCH] Fix for Network error attempting to view events without permissions (#31920) * Fix for #31918 Signed-off-by: kaustubh B * Update js/apps/admin-ui/src/realm-settings/RealmSettingsTabs.tsx Co-authored-by: Stan Silvert Signed-off-by: kaustubh-rh <88367583+kaustubh-rh@users.noreply.github.com> --------- Signed-off-by: kaustubh B Signed-off-by: kaustubh-rh <88367583+kaustubh-rh@users.noreply.github.com> Co-authored-by: Stan Silvert --- .../src/realm-settings/RealmSettingsTabs.tsx | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/js/apps/admin-ui/src/realm-settings/RealmSettingsTabs.tsx b/js/apps/admin-ui/src/realm-settings/RealmSettingsTabs.tsx index 587838eda5..9684d575b0 100644 --- a/js/apps/admin-ui/src/realm-settings/RealmSettingsTabs.tsx +++ b/js/apps/admin-ui/src/realm-settings/RealmSettingsTabs.tsx @@ -288,6 +288,9 @@ export const RealmSettingsTabs = () => { const clientPoliciesTab = useTab("client-policies"); const userProfileTab = useTab("user-profile"); const userRegistrationTab = useTab("user-registration"); + const { hasAccess, hasSomeAccess } = useAccess(); + const canViewOrManageEvents = + hasAccess("view-realm") && hasSomeAccess("view-events", "manage-events"); const useClientPoliciesTab = (tab: ClientPoliciesTab) => useRoutableTab( @@ -361,13 +364,15 @@ export const RealmSettingsTabs = () => { > - {t("events")}} - data-testid="rs-realm-events-tab" - {...eventsTab} - > - - + {canViewOrManageEvents && ( + {t("events")}} + data-testid="rs-realm-events-tab" + {...eventsTab} + > + + + )} {t("localization")}} data-testid="rs-localization-tab"