136 lines
3.4 KiB
TypeScript
136 lines
3.4 KiB
TypeScript
export const permissionCodes = {
|
|
store: {
|
|
create: "GAO:STORE:CREATE",
|
|
read: "GAO:STORE:READ",
|
|
export: "GAO:STORE:EXPORT",
|
|
update: "GAO:STORE:UPDATE",
|
|
delete: "GAO:STORE:DELETE"
|
|
},
|
|
customer: {
|
|
create: "GAO:CUSTOMER:CREATE",
|
|
read: "GAO:CUSTOMER:READ",
|
|
export: "GAO:CUSTOMER:EXPORT",
|
|
update: "GAO:CUSTOMER:UPDATE",
|
|
delete: "GAO:CUSTOMER:DELETE"
|
|
},
|
|
event: {
|
|
create: "GAO:EVENT:CREATE",
|
|
read: "GAO:EVENT:READ",
|
|
update: "GAO:EVENT:UPDATE",
|
|
delete: "GAO:EVENT:DELETE"
|
|
},
|
|
eventRecord: {
|
|
create: "GAO:EVENT_RECORD:CREATE",
|
|
read: "GAO:EVENT_RECORD:READ",
|
|
export: "GAO:EVENT_RECORD:EXPORT",
|
|
update: "GAO:EVENT_RECORD:UPDATE",
|
|
delete: "GAO:EVENT_RECORD:DELETE"
|
|
},
|
|
point: {
|
|
accountRead: "GAO:POINT_ACCOUNT:READ",
|
|
ledgerRead: "GAO:POINT_LEDGER:READ",
|
|
adjust: "GAO:POINT:ADJUST",
|
|
sourceValue: "GAO:POINT:SOURCE_VALUE"
|
|
},
|
|
pointRule: {
|
|
create: "GAO:POINT_RULE:CREATE",
|
|
read: "GAO:POINT_RULE:READ",
|
|
update: "GAO:POINT_RULE:UPDATE",
|
|
delete: "GAO:POINT_RULE:DELETE"
|
|
},
|
|
stat: {
|
|
read: "GAO:STAT:READ"
|
|
},
|
|
user: {
|
|
create: "GAO:USER:CREATE",
|
|
read: "GAO:USER:READ",
|
|
update: "GAO:USER:UPDATE",
|
|
delete: "GAO:USER:DELETE"
|
|
},
|
|
qrCode: {
|
|
create: "GAO:QR_CODE:CREATE"
|
|
}
|
|
} as const;
|
|
|
|
export const corePermissionCodes = {
|
|
role: {
|
|
create: "CORE:ROLE:CREATE",
|
|
read: "CORE:ROLE:READ",
|
|
update: "CORE:ROLE:UPDATE",
|
|
delete: "CORE:ROLE:DELETE"
|
|
},
|
|
permission: {
|
|
create: "CORE:PERMISSION:CREATE",
|
|
read: "CORE:PERMISSION:READ",
|
|
update: "CORE:PERMISSION:UPDATE",
|
|
delete: "CORE:PERMISSION:DELETE"
|
|
},
|
|
rolePermission: {
|
|
create: "CORE:ROLE_PERMISSION:CREATE",
|
|
read: "CORE:ROLE_PERMISSION:READ",
|
|
delete: "CORE:ROLE_PERMISSION:DELETE"
|
|
},
|
|
rolePermissionInherit: {
|
|
create: "CORE:ROLE_PERMISSION_INHERIT:CREATE",
|
|
read: "CORE:ROLE_PERMISSION_INHERIT:READ",
|
|
delete: "CORE:ROLE_PERMISSION_INHERIT:DELETE"
|
|
},
|
|
tag: {
|
|
create: "CORE:TAG:CREATE",
|
|
read: "CORE:TAG:READ",
|
|
apply: "CORE:TAG:APPLY",
|
|
update: "CORE:TAG:UPDATE",
|
|
delete: "CORE:TAG:DELETE"
|
|
},
|
|
userRole: {
|
|
create: "CORE:USER_ROLE:CREATE",
|
|
read: "CORE:USER_ROLE:READ",
|
|
delete: "CORE:USER_ROLE:DELETE"
|
|
}
|
|
} as const;
|
|
|
|
export const coreRoleCodes = {
|
|
admin: "CORE:ADMIN"
|
|
} as const;
|
|
|
|
export const gaoRoleCodes = {
|
|
globalManager: "GAO:GLOBAL_MANAGER",
|
|
storeManager: "GAO:STORE_MANAGER"
|
|
} as const;
|
|
|
|
/** 需要读取登录用户所属门店的业务权限。 */
|
|
export const gaoStoreScopePermissionCodes = [
|
|
permissionCodes.customer.create,
|
|
permissionCodes.customer.read,
|
|
permissionCodes.customer.export,
|
|
permissionCodes.customer.update,
|
|
permissionCodes.customer.delete,
|
|
permissionCodes.event.create,
|
|
permissionCodes.event.read,
|
|
permissionCodes.event.update,
|
|
permissionCodes.event.delete,
|
|
permissionCodes.eventRecord.create,
|
|
permissionCodes.eventRecord.read,
|
|
permissionCodes.eventRecord.export,
|
|
permissionCodes.eventRecord.update,
|
|
permissionCodes.eventRecord.delete,
|
|
permissionCodes.point.accountRead,
|
|
permissionCodes.point.ledgerRead,
|
|
permissionCodes.point.adjust,
|
|
permissionCodes.point.sourceValue,
|
|
permissionCodes.pointRule.create,
|
|
permissionCodes.pointRule.read,
|
|
permissionCodes.pointRule.update,
|
|
permissionCodes.pointRule.delete,
|
|
permissionCodes.stat.read,
|
|
permissionCodes.user.create,
|
|
permissionCodes.user.read,
|
|
permissionCodes.user.update,
|
|
permissionCodes.user.delete,
|
|
permissionCodes.qrCode.create
|
|
];
|
|
|
|
export type PermissionCodes = typeof permissionCodes;
|
|
export type CorePermissionCodes = typeof corePermissionCodes;
|
|
|