Skip to content

Commit

Permalink
feat(admin-ui): design the layout for api role management #327
Browse files Browse the repository at this point in the history
  • Loading branch information
syntrydy committed Dec 7, 2021
1 parent c8fcaf6 commit ad7b72c
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 36 deletions.
5 changes: 5 additions & 0 deletions app/utils/PermChecker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
export const BASE_URL = 'https://jans.io/oauth'

export const PROPERTIES_READ = BASE_URL + '/config/properties.readonly'
export const PROPERTIES_WRITE = BASE_URL + '/config/properties.write'
export const PROPERTIES_DELETE = BASE_URL + '/config/properties.delete'

export const ATTRIBUTE_READ = BASE_URL + '/config/attributes.readonly'
export const ATTRIBUTE_WRITE = BASE_URL + '/config/attributes.write'
export const ATTRIBUTE_DELETE = BASE_URL + '/config/attributes.delete'
Expand Down
1 change: 0 additions & 1 deletion plugins/admin/components/Permissions/UiPermListPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,4 @@ const mapStateToProps = (state) => {
permissions: state.authReducer.permissions,
}
}

export default connect(mapStateToProps)(UiPermListPage)
41 changes: 24 additions & 17 deletions plugins/admin/plugin-metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ import scriptReducer from './redux/reducers/CustomScriptReducer'
import apiRoleReducer from './redux/reducers/ApiRoleReducer'
import apiPermissionReducer from './redux/reducers/ApiPermissionReducer'
import licenseDetailsReducer from './redux/reducers/LicenseDetailsReducer'
import {
ACR_READ,
ROLE_READ,
PERMISSION_READ,
SCRIPT_READ,
SCRIPT_WRITE,
} from '../../app/utils/PermChecker'

const PLUGIN_BASE_APTH = '/adm'

Expand All @@ -32,42 +39,42 @@ const pluginMetadata = {
{
title: 'menus.licenseDetails',
path: PLUGIN_BASE_APTH + '/licenseDetails',
permission: '/config/acrs.readonly',
permission: ACR_READ,
},
{
title: 'menus.mau',
path: PLUGIN_BASE_APTH + '/mau',
permission: '/config/acrs.readonly',
permission: ACR_READ,
},
{
title: 'menus.config-api',
children: [
{
title: 'menus.api.roles',
path: PLUGIN_BASE_APTH + '/roles',
permission: '/config/acrs.readonly',
permission: ACR_READ,
},
{
title: 'menus.api.permissions',
path: PLUGIN_BASE_APTH + '/permissions',
permission: '/config/acrs.readonly',
permission: ACR_READ,
},
{
title: 'menus.api.mapping',
path: PLUGIN_BASE_APTH + '/mapping',
permission: '/config/acrs.readonly',
permission: ACR_READ,
},
],
},
{
title: 'menus.scripts',
path: PLUGIN_BASE_APTH + '/scripts',
permission: '/config/scripts.readonly',
permission: SCRIPT_READ,
},
{
title: 'menus.settings',
path: PLUGIN_BASE_APTH + '/settings',
permission: '/config/acrs.readonly',
permission: ACR_READ,
},
],
},
Expand All @@ -76,27 +83,27 @@ const pluginMetadata = {
{
component: HealthPage,
path: PLUGIN_BASE_APTH + '/health',
permission: '/config/acrs.readonly',
permission: ACR_READ,
},
{
component: ReportPage,
path: PLUGIN_BASE_APTH + '/reports',
permission: '/config/acrs.readonly',
permission: ACR_READ,
},
{
component: MonthlyActiveUsersPage,
path: PLUGIN_BASE_APTH + '/mau',
permission: '/config/acrs.readonly',
permission: ACR_READ,
},
{
component: UiRoleListPage,
path: PLUGIN_BASE_APTH + '/roles',
permission: '/config/acrs.readonly',
permission: ROLE_READ,
},
{
component: UiPermListPage,
path: PLUGIN_BASE_APTH + '/permissions',
permission: '/config/acrs.readonly',
permission: PERMISSION_READ,
},
{
component: UiRoleListPage,
Expand All @@ -106,27 +113,27 @@ const pluginMetadata = {
{
component: ScriptListPage,
path: PLUGIN_BASE_APTH + '/scripts',
permission: '/config/scripts.readonly',
permission: SCRIPT_READ,
},
{
component: CustomScriptAddPage,
path: PLUGIN_BASE_APTH + '/script/new',
permission: '/config/scripts.write',
permission: SCRIPT_WRITE,
},
{
component: CustomScriptEditPage,
path: PLUGIN_BASE_APTH + '/script/edit:id',
permission: '/config/scripts.write',
permission: SCRIPT_WRITE,
},
{
component: SettingsPage,
path: PLUGIN_BASE_APTH + '/settings',
permission: '/config/acrs.readonly',
permission: ACR_READ,
},
{
component: LicenseDetailsPage,
path: PLUGIN_BASE_APTH + '/licenseDetails',
permission: '/config/acrs.readonly',
permission: ACR_READ,
},
],
reducers: [
Expand Down
45 changes: 27 additions & 18 deletions plugins/auth-server/plugin-metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ import jwksSaga from './redux/sagas/JwksSaga'
import acrSaga from './redux/sagas/AcrsSaga'
import loggingSaga from './redux/sagas/LoggingSaga'
import healthSaga from './redux/sagas/HealthSaga'
import {
ACR_READ,
PROPERTIES_READ,
CLIENT_READ,
SCOPE_READ,
CLIENT_WRITE,
SCOPE_WRITE,
JWKS_READ,
} from '../../app/utils/PermChecker'

const PLUGIN_BASE_APTH = '/auth-server'

Expand All @@ -43,39 +52,39 @@ const pluginMetadata = {
{
title: 'menus.keys',
path: PLUGIN_BASE_APTH + '/config/keys',
permission: '/config/jwks.readonly',
permission: JWKS_READ,
},
{
title: 'menus.defaults',
path: PLUGIN_BASE_APTH + '/config/defaults',
permission: '/config/acrs.readonly',
permission: ACR_READ,
},
{
title: 'menus.properties',
path: PLUGIN_BASE_APTH + '/config/properties',
permission: '/config/acrs.readonly',
permission: PROPERTIES_READ,
},
{
title: 'menus.logging',
path: PLUGIN_BASE_APTH + '/config/logging',
permission: '/config/properties.readonly',
permission: PROPERTIES_READ,
},
],
},
{
title: 'menus.clients',
path: PLUGIN_BASE_APTH + '/clients',
permission: '/config/openid/clients.readonly',
permission: CLIENT_READ,
},
{
title: 'menus.health',
path: PLUGIN_BASE_APTH + '/health',
permission: '/config/acrs.readonly',
permission: PROPERTIES_READ,
},
{
title: 'menus.scopes',
path: PLUGIN_BASE_APTH + '/scopes',
permission: '/config/scopes.readonly',
permission: SCOPE_READ,
},
],
},
Expand All @@ -84,57 +93,57 @@ const pluginMetadata = {
{
component: ClientListPage,
path: PLUGIN_BASE_APTH + '/clients',
permission: '/config/openid/clients.readonly',
permission: CLIENT_READ,
},
{
component: ClientAddPage,
path: PLUGIN_BASE_APTH + '/client/new',
permission: '/config/openid/clients.write',
permission: CLIENT_WRITE,
},
{
component: ClientEditPage,
path: PLUGIN_BASE_APTH + '/client/edit:id',
permission: '/config/openid/clients.write',
permission: CLIENT_WRITE,
},
{
component: ScopeListPage,
path: PLUGIN_BASE_APTH + '/scopes',
permission: '/config/scopes.readonly',
permission: SCOPE_READ,
},
{
component: ScopeAddPage,
path: PLUGIN_BASE_APTH + '/scope/new',
permission: '/config/scopes.write',
permission: SCOPE_WRITE,
},
{
component: ScopeEditPage,
path: PLUGIN_BASE_APTH + '/scope/edit:id',
permission: '/config/scopes.write',
permission: SCOPE_WRITE,
},
{
component: PropertiesPage,
path: PLUGIN_BASE_APTH + '/config/properties',
permission: '/config/attributes.write',
permission: PROPERTIES_READ,
},
{
component: KeysPage,
path: PLUGIN_BASE_APTH + '/config/keys',
permission: '/config/jwks.readonly',
permission: JWKS_READ,
},
{
component: HealthPage,
path: PLUGIN_BASE_APTH + '/health',
permission: '/config/acrs.readonly',
permission: PROPERTIES_READ,
},
{
component: ReportPage,
path: PLUGIN_BASE_APTH + '/reports',
permission: '/config/acrs.readonly',
permission: PROPERTIES_READ,
},
{
component: DefaultPage,
path: PLUGIN_BASE_APTH + '/config/defaults',
permission: '/config/acrs.readonly',
permission: PROPERTIES_READ,
},
],
reducers: [
Expand Down

0 comments on commit ad7b72c

Please sign in to comment.