Skip to content

Commit

Permalink
Merge pull request #7051 from pavinduLakshan/fix_auditlog_permissions
Browse files Browse the repository at this point in the history
  • Loading branch information
pavinduLakshan authored Oct 28, 2024
2 parents bd99b13 + da5901a commit 5fe22b2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/chilly-cooks-cheat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@wso2is/admin.logs.v1": patch
---

Hide audit logs when the token doesn't has required feature scope
5 changes: 4 additions & 1 deletion features/admin.logs.v1/pages/logs-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/

import Chip from "@oxygen-ui/react/Chip";
import { useRequiredScopes } from "@wso2is/access-control";
import { AppState, FeatureConfigInterface } from "@wso2is/admin.core.v1";
import { IdentifiableComponentInterface } from "@wso2is/core/models";
import {
Expand Down Expand Up @@ -63,6 +64,8 @@ const LogsPage: FunctionComponent<LogsPageInterface> = (
const { t } = useTranslation();
const { getLink } = useDocumentation();

const hasAuditLogAccessPermissions: boolean = useRequiredScopes(featureConfig?.auditLogs?.scopes?.feature);

const handleTabChange = (e: SyntheticEvent, data: TabProps): void => {
setActiveTabIndex(data.activeIndex as number);
};
Expand Down Expand Up @@ -94,7 +97,7 @@ const LogsPage: FunctionComponent<LogsPageInterface> = (
}); }


{ featureConfig.auditLogs?.enabled && panes.push({
{ featureConfig.auditLogs?.enabled && hasAuditLogAccessPermissions && panes.push({
componentId: "audit-logs",
menuItem: (
<MenuItem key="text" className="item-with-chip">
Expand Down

0 comments on commit 5fe22b2

Please sign in to comment.