From 8e43fada74304e6e1eba65ac61078e2940c9cf96 Mon Sep 17 00:00:00 2001 From: Jatin Mehta Date: Wed, 22 Mar 2023 00:03:25 +0530 Subject: [PATCH] feat(admin-ui): add permissions for agama --- admin-ui/app/utils/PermChecker.js | 4 ++++ .../auth-server/components/Agama/AgamaListPage.js | 12 +++++------- admin-ui/plugins/auth-server/plugin-metadata.js | 7 ++++--- 3 files changed, 13 insertions(+), 10 deletions(-) diff --git a/admin-ui/app/utils/PermChecker.js b/admin-ui/app/utils/PermChecker.js index 9ccadb1ec..0979460e6 100644 --- a/admin-ui/app/utils/PermChecker.js +++ b/admin-ui/app/utils/PermChecker.js @@ -91,6 +91,10 @@ export const USER_READ = BASE_URL + '/config/user.readonly' export const USER_WRITE = BASE_URL + '/config/user.write' export const USER_DELETE = BASE_URL + '/config/user.delete' +export const AGAMA_READ = BASE_URL + '/config/agama.readonly' +export const AGAMA_WRITE = BASE_URL + '/config/agama.write' +export const AGAMA_DELETE = BASE_URL + '/config/agama.delete' + export const SESSION_READ = BASE_URL + '/jans-auth-server/session.readonly' export const SESSION_DELETE = BASE_URL + '/jans-auth-server/session.delete' diff --git a/admin-ui/plugins/auth-server/components/Agama/AgamaListPage.js b/admin-ui/plugins/auth-server/components/Agama/AgamaListPage.js index dc5076ccf..681ba7bb1 100644 --- a/admin-ui/plugins/auth-server/components/Agama/AgamaListPage.js +++ b/admin-ui/plugins/auth-server/components/Agama/AgamaListPage.js @@ -11,10 +11,8 @@ import { Paper, TablePagination } from '@material-ui/core' import { getAgama , postAgama} from '../../redux/actions/AgamaActions' import { hasPermission, - buildPayload, - SCOPE_READ, - SCOPE_WRITE, - SCOPE_DELETE, + AGAMA_READ, + AGAMA_WRITE } from 'Utils/PermChecker' import GluuViewWrapper from '../../../../app/routes/Apps/Gluu/GluuViewWrapper' import MaterialTable from '@material-table/core' @@ -138,7 +136,7 @@ function AgamaListPage() { dispatch(getAgama(options)) } - // if (hasPermission(permissions, USER_WRITE)) { + if (hasPermission(permissions, AGAMA_WRITE)) { myActions.push({ icon: 'add', tooltip: `${t('messages.add_role')}`, @@ -146,12 +144,12 @@ function AgamaListPage() { isFreeAction: true, onClick: () => setShowAddModal(true), }) - // } + } return ( - +