Skip to content

Commit ad7b72c

Browse files
committed
feat(admin-ui): design the layout for api role management #327
1 parent c8fcaf6 commit ad7b72c

File tree

4 files changed

+56
-36
lines changed

4 files changed

+56
-36
lines changed

app/utils/PermChecker.js

+5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
export const BASE_URL = 'https://jans.io/oauth'
2+
3+
export const PROPERTIES_READ = BASE_URL + '/config/properties.readonly'
4+
export const PROPERTIES_WRITE = BASE_URL + '/config/properties.write'
5+
export const PROPERTIES_DELETE = BASE_URL + '/config/properties.delete'
6+
27
export const ATTRIBUTE_READ = BASE_URL + '/config/attributes.readonly'
38
export const ATTRIBUTE_WRITE = BASE_URL + '/config/attributes.write'
49
export const ATTRIBUTE_DELETE = BASE_URL + '/config/attributes.delete'

plugins/admin/components/Permissions/UiPermListPage.js

-1
Original file line numberDiff line numberDiff line change
@@ -117,5 +117,4 @@ const mapStateToProps = (state) => {
117117
permissions: state.authReducer.permissions,
118118
}
119119
}
120-
121120
export default connect(mapStateToProps)(UiPermListPage)

plugins/admin/plugin-metadata.js

+24-17
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ import scriptReducer from './redux/reducers/CustomScriptReducer'
2020
import apiRoleReducer from './redux/reducers/ApiRoleReducer'
2121
import apiPermissionReducer from './redux/reducers/ApiPermissionReducer'
2222
import licenseDetailsReducer from './redux/reducers/LicenseDetailsReducer'
23+
import {
24+
ACR_READ,
25+
ROLE_READ,
26+
PERMISSION_READ,
27+
SCRIPT_READ,
28+
SCRIPT_WRITE,
29+
} from '../../app/utils/PermChecker'
2330

2431
const PLUGIN_BASE_APTH = '/adm'
2532

@@ -32,42 +39,42 @@ const pluginMetadata = {
3239
{
3340
title: 'menus.licenseDetails',
3441
path: PLUGIN_BASE_APTH + '/licenseDetails',
35-
permission: '/config/acrs.readonly',
42+
permission: ACR_READ,
3643
},
3744
{
3845
title: 'menus.mau',
3946
path: PLUGIN_BASE_APTH + '/mau',
40-
permission: '/config/acrs.readonly',
47+
permission: ACR_READ,
4148
},
4249
{
4350
title: 'menus.config-api',
4451
children: [
4552
{
4653
title: 'menus.api.roles',
4754
path: PLUGIN_BASE_APTH + '/roles',
48-
permission: '/config/acrs.readonly',
55+
permission: ACR_READ,
4956
},
5057
{
5158
title: 'menus.api.permissions',
5259
path: PLUGIN_BASE_APTH + '/permissions',
53-
permission: '/config/acrs.readonly',
60+
permission: ACR_READ,
5461
},
5562
{
5663
title: 'menus.api.mapping',
5764
path: PLUGIN_BASE_APTH + '/mapping',
58-
permission: '/config/acrs.readonly',
65+
permission: ACR_READ,
5966
},
6067
],
6168
},
6269
{
6370
title: 'menus.scripts',
6471
path: PLUGIN_BASE_APTH + '/scripts',
65-
permission: '/config/scripts.readonly',
72+
permission: SCRIPT_READ,
6673
},
6774
{
6875
title: 'menus.settings',
6976
path: PLUGIN_BASE_APTH + '/settings',
70-
permission: '/config/acrs.readonly',
77+
permission: ACR_READ,
7178
},
7279
],
7380
},
@@ -76,27 +83,27 @@ const pluginMetadata = {
7683
{
7784
component: HealthPage,
7885
path: PLUGIN_BASE_APTH + '/health',
79-
permission: '/config/acrs.readonly',
86+
permission: ACR_READ,
8087
},
8188
{
8289
component: ReportPage,
8390
path: PLUGIN_BASE_APTH + '/reports',
84-
permission: '/config/acrs.readonly',
91+
permission: ACR_READ,
8592
},
8693
{
8794
component: MonthlyActiveUsersPage,
8895
path: PLUGIN_BASE_APTH + '/mau',
89-
permission: '/config/acrs.readonly',
96+
permission: ACR_READ,
9097
},
9198
{
9299
component: UiRoleListPage,
93100
path: PLUGIN_BASE_APTH + '/roles',
94-
permission: '/config/acrs.readonly',
101+
permission: ROLE_READ,
95102
},
96103
{
97104
component: UiPermListPage,
98105
path: PLUGIN_BASE_APTH + '/permissions',
99-
permission: '/config/acrs.readonly',
106+
permission: PERMISSION_READ,
100107
},
101108
{
102109
component: UiRoleListPage,
@@ -106,27 +113,27 @@ const pluginMetadata = {
106113
{
107114
component: ScriptListPage,
108115
path: PLUGIN_BASE_APTH + '/scripts',
109-
permission: '/config/scripts.readonly',
116+
permission: SCRIPT_READ,
110117
},
111118
{
112119
component: CustomScriptAddPage,
113120
path: PLUGIN_BASE_APTH + '/script/new',
114-
permission: '/config/scripts.write',
121+
permission: SCRIPT_WRITE,
115122
},
116123
{
117124
component: CustomScriptEditPage,
118125
path: PLUGIN_BASE_APTH + '/script/edit:id',
119-
permission: '/config/scripts.write',
126+
permission: SCRIPT_WRITE,
120127
},
121128
{
122129
component: SettingsPage,
123130
path: PLUGIN_BASE_APTH + '/settings',
124-
permission: '/config/acrs.readonly',
131+
permission: ACR_READ,
125132
},
126133
{
127134
component: LicenseDetailsPage,
128135
path: PLUGIN_BASE_APTH + '/licenseDetails',
129-
permission: '/config/acrs.readonly',
136+
permission: ACR_READ,
130137
},
131138
],
132139
reducers: [

plugins/auth-server/plugin-metadata.js

+27-18
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@ import jwksSaga from './redux/sagas/JwksSaga'
2828
import acrSaga from './redux/sagas/AcrsSaga'
2929
import loggingSaga from './redux/sagas/LoggingSaga'
3030
import healthSaga from './redux/sagas/HealthSaga'
31+
import {
32+
ACR_READ,
33+
PROPERTIES_READ,
34+
CLIENT_READ,
35+
SCOPE_READ,
36+
CLIENT_WRITE,
37+
SCOPE_WRITE,
38+
JWKS_READ,
39+
} from '../../app/utils/PermChecker'
3140

3241
const PLUGIN_BASE_APTH = '/auth-server'
3342

@@ -43,39 +52,39 @@ const pluginMetadata = {
4352
{
4453
title: 'menus.keys',
4554
path: PLUGIN_BASE_APTH + '/config/keys',
46-
permission: '/config/jwks.readonly',
55+
permission: JWKS_READ,
4756
},
4857
{
4958
title: 'menus.defaults',
5059
path: PLUGIN_BASE_APTH + '/config/defaults',
51-
permission: '/config/acrs.readonly',
60+
permission: ACR_READ,
5261
},
5362
{
5463
title: 'menus.properties',
5564
path: PLUGIN_BASE_APTH + '/config/properties',
56-
permission: '/config/acrs.readonly',
65+
permission: PROPERTIES_READ,
5766
},
5867
{
5968
title: 'menus.logging',
6069
path: PLUGIN_BASE_APTH + '/config/logging',
61-
permission: '/config/properties.readonly',
70+
permission: PROPERTIES_READ,
6271
},
6372
],
6473
},
6574
{
6675
title: 'menus.clients',
6776
path: PLUGIN_BASE_APTH + '/clients',
68-
permission: '/config/openid/clients.readonly',
77+
permission: CLIENT_READ,
6978
},
7079
{
7180
title: 'menus.health',
7281
path: PLUGIN_BASE_APTH + '/health',
73-
permission: '/config/acrs.readonly',
82+
permission: PROPERTIES_READ,
7483
},
7584
{
7685
title: 'menus.scopes',
7786
path: PLUGIN_BASE_APTH + '/scopes',
78-
permission: '/config/scopes.readonly',
87+
permission: SCOPE_READ,
7988
},
8089
],
8190
},
@@ -84,57 +93,57 @@ const pluginMetadata = {
8493
{
8594
component: ClientListPage,
8695
path: PLUGIN_BASE_APTH + '/clients',
87-
permission: '/config/openid/clients.readonly',
96+
permission: CLIENT_READ,
8897
},
8998
{
9099
component: ClientAddPage,
91100
path: PLUGIN_BASE_APTH + '/client/new',
92-
permission: '/config/openid/clients.write',
101+
permission: CLIENT_WRITE,
93102
},
94103
{
95104
component: ClientEditPage,
96105
path: PLUGIN_BASE_APTH + '/client/edit:id',
97-
permission: '/config/openid/clients.write',
106+
permission: CLIENT_WRITE,
98107
},
99108
{
100109
component: ScopeListPage,
101110
path: PLUGIN_BASE_APTH + '/scopes',
102-
permission: '/config/scopes.readonly',
111+
permission: SCOPE_READ,
103112
},
104113
{
105114
component: ScopeAddPage,
106115
path: PLUGIN_BASE_APTH + '/scope/new',
107-
permission: '/config/scopes.write',
116+
permission: SCOPE_WRITE,
108117
},
109118
{
110119
component: ScopeEditPage,
111120
path: PLUGIN_BASE_APTH + '/scope/edit:id',
112-
permission: '/config/scopes.write',
121+
permission: SCOPE_WRITE,
113122
},
114123
{
115124
component: PropertiesPage,
116125
path: PLUGIN_BASE_APTH + '/config/properties',
117-
permission: '/config/attributes.write',
126+
permission: PROPERTIES_READ,
118127
},
119128
{
120129
component: KeysPage,
121130
path: PLUGIN_BASE_APTH + '/config/keys',
122-
permission: '/config/jwks.readonly',
131+
permission: JWKS_READ,
123132
},
124133
{
125134
component: HealthPage,
126135
path: PLUGIN_BASE_APTH + '/health',
127-
permission: '/config/acrs.readonly',
136+
permission: PROPERTIES_READ,
128137
},
129138
{
130139
component: ReportPage,
131140
path: PLUGIN_BASE_APTH + '/reports',
132-
permission: '/config/acrs.readonly',
141+
permission: PROPERTIES_READ,
133142
},
134143
{
135144
component: DefaultPage,
136145
path: PLUGIN_BASE_APTH + '/config/defaults',
137-
permission: '/config/acrs.readonly',
146+
permission: PROPERTIES_READ,
138147
},
139148
],
140149
reducers: [

0 commit comments

Comments
 (0)