Skip to content

Commit

Permalink
feat(admin-ui): add permissions for agama
Browse files Browse the repository at this point in the history
  • Loading branch information
mjatin-dev committed Mar 21, 2023
1 parent adc3371 commit 8e43fad
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
4 changes: 4 additions & 0 deletions admin-ui/app/utils/PermChecker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
12 changes: 5 additions & 7 deletions admin-ui/plugins/auth-server/components/Agama/AgamaListPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -138,20 +136,20 @@ function AgamaListPage() {
dispatch(getAgama(options))
}

// if (hasPermission(permissions, USER_WRITE)) {
if (hasPermission(permissions, AGAMA_WRITE)) {
myActions.push({
icon: 'add',
tooltip: `${t('messages.add_role')}`,
iconProps: { color: 'primary' },
isFreeAction: true,
onClick: () => setShowAddModal(true),
})
// }
}

return (
<Card style={applicationStyle.mainCard}>
<CardBody>
<GluuViewWrapper canShow={hasPermission(permissions, SCOPE_READ)}>
<GluuViewWrapper canShow={hasPermission(permissions, AGAMA_READ)}>
<MaterialTable
key={limit}
components={{
Expand Down
7 changes: 4 additions & 3 deletions admin-ui/plugins/auth-server/plugin-metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ import {
JWKS_READ,
SESSION_READ,
PROPERTIES_READ,
LOGGING_READ
LOGGING_READ,
AGAMA_READ
} from 'Utils/PermChecker'
import AgamaListPage from './components/Agama/AgamaListPage'
import agamaReducer from './redux/reducers/AgamaReducer'
Expand Down Expand Up @@ -93,7 +94,7 @@ const pluginMetadata = {
{
title: 'menus.agama',
path: PLUGIN_BASE_APTH + '/agama',
permission: SCOPE_READ,
permission: AGAMA_READ,
},
],
},
Expand Down Expand Up @@ -157,7 +158,7 @@ const pluginMetadata = {
{
component: AgamaListPage,
path: PLUGIN_BASE_APTH + '/agama',
permission: ACR_READ,
permission: AGAMA_READ,
},
// {
// component: AgamaAddPage,
Expand Down

0 comments on commit 8e43fad

Please sign in to comment.