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 8, 2021
1 parent ad7b72c commit f848b42
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 34 deletions.
2 changes: 0 additions & 2 deletions app/utils/PermChecker.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ export const STAT_READ = BASE_URL + '/config/stats.readonly'
export const STAT_JANS_READ = 'jans_stat'

export const hasPermission = (scopes, scope) => {
console.log('============1 ' + JSON.stringify(scopes))
console.log('============2 ' + JSON.stringify(scope))
if (scopes) {
return scopes.includes(scope, 0)
}
Expand Down
15 changes: 7 additions & 8 deletions plugins/auth-server/plugin-metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import loggingSaga from './redux/sagas/LoggingSaga'
import healthSaga from './redux/sagas/HealthSaga'
import {
ACR_READ,
PROPERTIES_READ,
CLIENT_READ,
SCOPE_READ,
CLIENT_WRITE,
Expand Down Expand Up @@ -62,12 +61,12 @@ const pluginMetadata = {
{
title: 'menus.properties',
path: PLUGIN_BASE_APTH + '/config/properties',
permission: PROPERTIES_READ,
permission: ACR_READ,
},
{
title: 'menus.logging',
path: PLUGIN_BASE_APTH + '/config/logging',
permission: PROPERTIES_READ,
permission: ACR_READ,
},
],
},
Expand All @@ -79,7 +78,7 @@ const pluginMetadata = {
{
title: 'menus.health',
path: PLUGIN_BASE_APTH + '/health',
permission: PROPERTIES_READ,
permission: ACR_READ,
},
{
title: 'menus.scopes',
Expand Down Expand Up @@ -123,7 +122,7 @@ const pluginMetadata = {
{
component: PropertiesPage,
path: PLUGIN_BASE_APTH + '/config/properties',
permission: PROPERTIES_READ,
permission: ACR_READ,
},
{
component: KeysPage,
Expand All @@ -133,17 +132,17 @@ const pluginMetadata = {
{
component: HealthPage,
path: PLUGIN_BASE_APTH + '/health',
permission: PROPERTIES_READ,
permission: ACR_READ,
},
{
component: ReportPage,
path: PLUGIN_BASE_APTH + '/reports',
permission: PROPERTIES_READ,
permission: ACR_READ,
},
{
component: DefaultPage,
path: PLUGIN_BASE_APTH + '/config/defaults',
permission: PROPERTIES_READ,
permission: ACR_READ,
},
],
reducers: [
Expand Down
19 changes: 8 additions & 11 deletions plugins/schema/plugin-metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import AttributeEditPage from './components/Person/AttributeEditPage'
import AttributeViewPage from './components/Person/AttributeViewPage'
import attributeReducer from './redux/reducers/AttributeReducer'
import attributeSaga from './redux/sagas/AttributeSaga'
import { ATTRIBUTE_READ, ATTRIBUTE_WRITE } from '../../app/utils//PermChecker'

const pluginMetadata = {
menus: [
Expand All @@ -14,7 +15,7 @@ const pluginMetadata = {
{
title: 'menus.person',
path: '/attributes',
permission: '/config/attributes.readonly',
permission: ATTRIBUTE_READ,
},
],
},
Expand All @@ -23,30 +24,26 @@ const pluginMetadata = {
{
component: AttributeEditPage,
path: '/attribute/edit:gid',
permission: '/config/attributes.write',
permission: ATTRIBUTE_WRITE,
},
{
component: AttributeViewPage,
path: '/attribute/view:gid',
permission: '/config/attributes.readonly',
permission: ATTRIBUTE_READ,
},
{
component: AttributeAddPage,
path: '/attribute/new',
permission: '/config/attributes.write',
permission: ATTRIBUTE_WRITE,
},
{
component: AttributeListPage,
path: '/attributes',
permission: '/config/attributes.readonly',
permission: ATTRIBUTE_READ,
},
],
reducers: [
{ name: 'attributeReducer', reducer: attributeReducer },
],
sagas: [
attributeSaga(),
],
reducers: [{ name: 'attributeReducer', reducer: attributeReducer }],
sagas: [attributeSaga()],
}

export default pluginMetadata
42 changes: 29 additions & 13 deletions plugins/services-plugin/plugin-metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ import ldapSaga from './redux/sagas/LdapSaga'
import sqlSaga from './redux/sagas/SqlSaga'
import persistenceTypeSaga from './redux/sagas/PersistenceTypeSaga'
import smtpSaga from './redux/sagas/SmtpSaga'
import {
CACHE_READ,
CACHE_WRITE,
COUCHBASE_READ,
LDAP_READ,
LDAP_WRITE,
SQL_READ,
SQL_WRITE,
} from '../../app/utils/PermChecker'

const pluginMetadata = {
menus: [
Expand All @@ -28,25 +37,25 @@ const pluginMetadata = {
{
title: 'menus.cache',
path: '/config/cache',
permission: '/config/cache.readonly',
permission: CACHE_READ,
},
{
title: 'menus.persistence',
children: [
{
title: 'menus.couchbase',
path: '/config/couchbase',
permission: '/config/database/couchbase.readonly',
permission: COUCHBASE_READ,
},
{
title: 'menus.ldap',
path: '/config/ldap',
permission: '/config/database/ldap.readonly',
permission: LDAP_READ,
},
{
title: 'menus.sql',
path: '/config/sql',
permission: '/config/database/sql.readonly',
permission: SQL_READ,
},
],
},
Expand All @@ -57,42 +66,42 @@ const pluginMetadata = {
{
component: CachePage,
path: '/config/cache',
permission: '/config/cache.readonly',
permission: CACHE_READ,
},
{
component: LdapEditPage,
path: '/config/ldap/edit:configId',
permission: '/config/database/ldap.readonly',
permission: CACHE_WRITE,
},
{
component: LdapAddPage,
path: '/config/ldap/new',
permission: '/config/database/ldap.readonly',
permission: LDAP_WRITE,
},
{
component: LdapListPage,
path: '/config/ldap',
permission: '/config/database/ldap.readonly',
permission: LDAP_READ,
},
{
component: SqlEditPage,
path: '/config/sql/edit:configId',
permission: '/config/database/sql.readonly',
permission: SQL_WRITE,
},
{
component: SqlAddPage,
path: '/config/sql/new',
permission: '/config/database/sql.readonly',
permission: SQL_WRITE,
},
{
component: SqlListPage,
path: '/config/sql',
permission: '/config/database/sql.readonly',
permission: SQL_READ,
},
{
component: CouchbasePage,
path: '/config/couchbase',
permission: '/config/database/couchbase.readonly',
permission: COUCHBASE_READ,
},
],
reducers: [
Expand All @@ -103,7 +112,14 @@ const pluginMetadata = {
{ name: 'smtpReducer', reducer: smtpReducer },
{ name: 'persistenceTypeReducer', reducer: persistenceTypeReducer },
],
sagas: [cacheSaga(), couchbaseSaga(), ldapSaga(), smtpSaga(), sqlSaga(), persistenceTypeSaga(),],
sagas: [
cacheSaga(),
couchbaseSaga(),
ldapSaga(),
smtpSaga(),
sqlSaga(),
persistenceTypeSaga(),
],
}

export default pluginMetadata

0 comments on commit f848b42

Please sign in to comment.