-
Notifications
You must be signed in to change notification settings - Fork 32
/
app-permissions.config.ts
366 lines (358 loc) · 10.5 KB
/
app-permissions.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
import {ApiRole} from "ordercloud-javascript-sdk"
export type AppPermission =
| "ProfileManager"
| "DashboardViewer"
| "SecurityProfileViewer"
| "SecurityProfileManager"
| "ProductViewer"
| "ProductManager"
| "PromotionViewer"
| "PromotionManager"
| "OrderViewer"
| "OrderManager"
| "BuyerViewer"
| "BuyerManager"
| "BuyerUserViewer"
| "BuyerUserManager"
| "BuyerUserGroupViewer"
| "BuyerUserGroupManager"
| "BuyerCatalogViewer"
| "BuyerCatalogManager"
| "SupplierViewer"
| "SupplierManager"
| "SupplierUserViewer"
| "SupplierUserManager"
| "SupplierUserGroupViewer"
| "SupplierUserGroupManager"
| "SupplierAddressViewer"
| "SupplierAddressManager"
| "AdminUserViewer"
| "AdminUserManager"
| "AdminUserGroupViewer"
| "AdminUserGroupManager"
| "AdminAddressViewer"
| "AdminAddressManager"
| "ProductFacetViewer"
| "ProductFacetManager"
export interface PermissionConfig {
/**
* The name of the permission, displayed in the UI for admins
*/
Name: string
/**
* A short description of the permission, displayed in the UI for admins
*/
Description: string
/**
* A list of API roles that are needed for this permission
*/
Roles: ApiRole[]
/**
* A list of custom roles that are needed for this permission
*/
CustomRoles: string[]
/**
* A list of user types that are allowed to have this permission
*/
AllowedUserType: ("Supplier" | "Admin")[]
/**
* How to group permissions in the UI
*/
Group: string
}
export const appPermissions: Record<AppPermission, PermissionConfig> = {
ProductViewer: {
Name: "Product Viewer",
Description: "View products",
Roles: [
"ProductReader",
"PriceScheduleReader",
"CatalogReader",
"CategoryReader",
"BuyerReader",
"UserGroupReader",
"AdminAddressReader",
"SupplierAddressReader",
"ProductFacetReader",
"SupplierReader"
],
CustomRoles: ["ProductViewer"],
AllowedUserType: ["Supplier", "Admin"],
Group: "Product"
},
ProductManager: {
Name: "Product Manager",
Description: "View, and manage products",
Roles: [
"ProductAdmin",
"PriceScheduleAdmin",
"CatalogAdmin",
"CategoryAdmin",
"BuyerReader",
"UserGroupReader",
"AdminAddressReader",
"SupplierAddressReader",
"ProductFacetReader",
"SupplierReader"
],
CustomRoles: ["ProductManager"],
AllowedUserType: ["Supplier", "Admin"],
Group: "Product"
},
PromotionViewer: {
Name: "Promotion Viewer",
Description: "View promotions",
Roles: ["PromotionReader"],
CustomRoles: ["PromotionViewer"],
AllowedUserType: ["Supplier", "Admin"],
Group: "Product"
},
PromotionManager: {
Name: "Promotion Manager",
Description: "View, and manage promotions",
Roles: ["PromotionAdmin"],
CustomRoles: ["PromotionManager"],
AllowedUserType: ["Supplier", "Admin"],
Group: "Product"
},
OrderViewer: {
Name: "Order Viewer",
Description: "View orders, shipments, and order returns",
Roles: ["OrderReader", "ShipmentReader", "SupplierReader", "SupplierAddressReader"],
CustomRoles: ["OrderViewer"],
AllowedUserType: ["Supplier", "Admin"],
Group: "Order"
},
OrderManager: {
Name: "Order Manager",
Description: "View and manage orders, shipments, and order returns",
Roles: ["OrderAdmin", "ShipmentAdmin", "SupplierReader", "SupplierAddressReader"],
CustomRoles: ["OrderManager"],
AllowedUserType: ["Supplier", "Admin"],
Group: "Order"
},
BuyerViewer: {
Name: "Buyer Viewer",
Description: "View buyers",
Roles: ["BuyerReader", "CatalogReader"],
CustomRoles: ["BuyerViewer"],
AllowedUserType: ["Admin"],
Group: "Buyer"
},
BuyerManager: {
Name: "Buyer Manager",
Description: "View, and manage buyers",
Roles: ["BuyerAdmin", "CatalogReader"],
CustomRoles: ["BuyerManager"],
AllowedUserType: ["Admin"],
Group: "Buyer"
},
BuyerUserViewer: {
Name: "Buyer User Viewer",
Description: "View buyer users",
Roles: ["BuyerUserReader"],
CustomRoles: ["BuyerUserViewer"],
AllowedUserType: ["Admin"],
Group: "Buyer"
},
BuyerUserManager: {
Name: "Buyer User Manager",
Description: "View, and manage buyer users",
Roles: ["BuyerUserAdmin"],
CustomRoles: ["BuyerUserManager"],
AllowedUserType: ["Admin"],
Group: "Buyer"
},
BuyerUserGroupViewer: {
Name: "Buyer User Group Viewer",
Description: "View buyer user groups",
Roles: ["UserGroupReader"],
CustomRoles: ["BuyerUserGroupViewer"],
AllowedUserType: ["Admin"],
Group: "Buyer"
},
BuyerUserGroupManager: {
Name: "Buyer User Group Manager",
Description: "View, and manage buyer user groups",
Roles: ["UserGroupAdmin"],
CustomRoles: ["BuyerUserGroupManager"],
AllowedUserType: ["Admin"],
Group: "Buyer"
},
BuyerCatalogViewer: {
Name: "Buyer Catalog Viewer",
Description: "View catalogs",
Roles: ["CatalogReader", "CategoryReader"],
CustomRoles: ["BuyerCatalogViewer"],
AllowedUserType: ["Admin"],
Group: "Buyer"
},
BuyerCatalogManager: {
Name: "Buyer Catalog Manager",
Description: "View, and manage catalogs",
Roles: ["CatalogAdmin", "CategoryAdmin"],
CustomRoles: ["BuyerCatalogManager"],
AllowedUserType: ["Admin"],
Group: "Buyer"
},
SupplierViewer: {
Name: "Supplier Viewer",
Description: "View suppliers",
Roles: ["SupplierReader"],
CustomRoles: ["SupplierViewer"],
AllowedUserType: ["Supplier", "Admin"],
Group: "Supplier"
},
SupplierManager: {
Name: "Supplier Manager",
Description: "View, and manage suppliers",
Roles: ["SupplierAdmin"],
CustomRoles: ["SupplierManager"],
AllowedUserType: ["Supplier", "Admin"],
Group: "Supplier"
},
SupplierUserViewer: {
Name: "Supplier User Viewer",
Description: "View supplier users",
Roles: ["SupplierUserReader"],
CustomRoles: ["SupplierUserViewer"],
AllowedUserType: ["Supplier", "Admin"],
Group: "Supplier"
},
SupplierUserManager: {
Name: "Supplier User Manager",
Description: "View, and manage supplier users",
Roles: ["SupplierUserAdmin"],
CustomRoles: ["SupplierUserManager"],
AllowedUserType: ["Supplier", "Admin"],
Group: "Supplier"
},
SupplierUserGroupViewer: {
Name: "Supplier User Group Viewer",
Description: "View supplier user groups",
Roles: ["SupplierUserGroupReader"],
CustomRoles: ["SupplierUserGroupViewer"],
AllowedUserType: ["Supplier", "Admin"],
Group: "Supplier"
},
SupplierUserGroupManager: {
Name: "Supplier User Group Manager",
Description: "View, and manage supplier user groups",
Roles: ["SupplierUserGroupAdmin"],
CustomRoles: ["SupplierUserGroupManager"],
AllowedUserType: ["Supplier", "Admin"],
Group: "Supplier"
},
SupplierAddressViewer: {
Name: "Supplier Address Viewer",
Description: "View supplier addresses",
Roles: ["SupplierAddressReader"],
CustomRoles: ["SupplierAddressViewer"],
AllowedUserType: ["Supplier", "Admin"],
Group: "Supplier"
},
SupplierAddressManager: {
Name: "Supplier Address Manager",
Description: "View, and manage supplier addresses",
Roles: ["SupplierAddressAdmin"],
CustomRoles: ["SupplierAddressManager"],
AllowedUserType: ["Supplier", "Admin"],
Group: "Supplier"
},
AdminUserViewer: {
Name: "Admin User Viewer",
Description: "View admin users",
Roles: ["AdminUserReader", "AdminUserGroupReader"],
CustomRoles: ["AdminUserViewer"],
AllowedUserType: ["Admin"],
Group: "Admin"
},
AdminUserManager: {
Name: "Admin User Manager",
Description: "View, and manage admin users",
Roles: ["AdminUserAdmin", "AdminUserGroupReader"],
CustomRoles: ["AdminUserManager"],
AllowedUserType: ["Admin"],
Group: "Admin"
},
AdminUserGroupViewer: {
Name: "Admin User Group Viewer",
Description: "View admin user groups",
Roles: ["AdminUserGroupReader"],
CustomRoles: ["AdminUserGroupViewer"],
AllowedUserType: ["Admin"],
Group: "Admin"
},
AdminUserGroupManager: {
Name: "Admin User Group Manager",
Description: "View, and manage admin user groups",
Roles: ["AdminUserGroupAdmin"],
CustomRoles: ["AdminUserGroupManager"],
AllowedUserType: ["Admin"],
Group: "Admin"
},
AdminAddressViewer: {
Name: "Admin Address Viewer",
Description: "View admin addresses",
Roles: ["AdminAddressReader"],
CustomRoles: ["AdminAddressViewer"],
AllowedUserType: ["Admin"],
Group: "Admin"
},
AdminAddressManager: {
Name: "Admin Address Manager",
Description: "View, and manage admin addresses",
Roles: ["AdminAddressAdmin"],
CustomRoles: ["AdminAddressManager"],
AllowedUserType: ["Admin"],
Group: "Admin"
},
ProductFacetViewer: {
Name: "Product Facet Viewer",
Description: "View product facets",
Roles: ["ProductFacetReader"],
CustomRoles: ["ProductFacetViewer"],
AllowedUserType: ["Admin"],
Group: "Admin"
},
ProductFacetManager: {
Name: "Product Facet Manager",
Description: "View, and manage product facets",
Roles: ["ProductFacetAdmin"],
CustomRoles: ["ProductFacetManager"],
AllowedUserType: ["Admin"],
Group: "Admin"
},
SecurityProfileViewer: {
Name: "Security Profile Viewer",
Description: "View security profiles",
Roles: ["SecurityProfileReader", "SupplierUserGroupReader", "AdminUserGroupReader", "UserGroupReader"],
CustomRoles: ["SecurityProfileViewer"],
AllowedUserType: ["Admin"],
Group: "Security"
},
SecurityProfileManager: {
Name: "Security Profile Manager",
Description: "View, and manage security profiles, as well as view and manage assignments to users, and companies",
Roles: ["SecurityProfileAdmin", "SupplierUserGroupAdmin", "AdminUserGroupAdmin", "UserGroupAdmin"],
CustomRoles: ["SecurityProfileManager"],
AllowedUserType: ["Admin"],
Group: "Security"
},
ProfileManager: {
Name: "Profile Manager",
Description: "View, and manage own profile, notifications, and theme",
Roles: ["MeAdmin"],
CustomRoles: ["ProfileManager"],
AllowedUserType: ["Supplier", "Admin"],
Group: "Miscellaneous"
},
DashboardViewer: {
Name: "Dashboard Viewer",
Description: "View dashboard reports",
Roles: ["ProductReader", "OrderReader", "PromotionReader", "BuyerUserReader"],
CustomRoles: ["DashboardViewer"],
AllowedUserType: ["Supplier", "Admin"],
Group: "Miscellaneous"
}
}