Skip to content

Commit

Permalink
[feature]:(SqlManagementCon、VersionManagement) refactor permission codes
Browse files Browse the repository at this point in the history
  • Loading branch information
LZS911 committed Nov 5, 2024
1 parent e3242bf commit b11e7fd
Show file tree
Hide file tree
Showing 20 changed files with 998 additions and 406 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,11 +161,29 @@ exports[`usePermission should match snapshot 1`] = `
"UPDATE_PRIORITY": "action:update_sql_priority",
"UPDATE_STATUS": "action:update_sql_status",
},
"SQL_MANAGEMENT_CONF": {
"CREATE": "action:sql_management_conf_create_operator",
"DELETE": "action:sql_management_conf_delete_operator",
"DETAIL_AUDIT": "action:sql_management_conf_detail_audit_operator",
"DETAIL_DELETE": "action:sql_management_conf_detail_delete_operator",
"DETAIL_ENABLE": "action:sql_management_conf_detail_enable_operator",
"DETAIL_STOP": "action:sql_management_conf_detail_stop_operator",
"EDIT": "action:sql_management_conf_edit_operator",
"ENABLE": "action:sql_management_conf_enable_operator",
"STOP": "action:sql_management_conf_stop_operator",
},
"SQL_MANAGEMENT_EXCEPTION": {
"CREATE": "action:create_sql_management_exception",
"DELETE": "action:delete_sql_management_exception",
"EDIT": "action:edit_sql_management_exception",
},
"VERSION_MANAGEMENT": {
"ADD": "action:version_management_add_operator",
"DELETE": "action:version_management_delete_operator",
"DEPLOY": "action:version_management_deploy_operator",
"EDIT": "action:version_management_edit_operator",
"LOCK": "action:version_management_lock_operator",
},
"WHITE_LIST": {
"CREATE": "action:white_list_creation",
"DELETE": "action:delete_white_list",
Expand Down Expand Up @@ -989,6 +1007,119 @@ exports[`usePermission should match snapshot 2`] = `
],
"type": "action",
},
"action:sql_management_conf_create_operator": {
"id": "action:sql_management_conf_create_operator",
"projectArchived": false,
"type": "action",
},
"action:sql_management_conf_delete_operator": {
"dbServicePermission": {
"fieldName": "instance_id",
"opType": "save_audit_plan",
},
"id": "action:sql_management_conf_delete_operator",
"projectArchived": false,
"projectManager": true,
"role": [
"admin",
"globalManager",
],
"type": "action",
},
"action:sql_management_conf_detail_audit_operator": {
"dbServicePermission": {
"opType": "save_audit_plan",
},
"id": "action:sql_management_conf_detail_audit_operator",
"projectArchived": false,
"projectManager": true,
"role": [
"admin",
"globalManager",
],
"type": "action",
},
"action:sql_management_conf_detail_delete_operator": {
"dbServicePermission": {
"opType": "save_audit_plan",
},
"id": "action:sql_management_conf_detail_delete_operator",
"projectArchived": false,
"projectManager": true,
"role": [
"admin",
"globalManager",
],
"type": "action",
},
"action:sql_management_conf_detail_enable_operator": {
"dbServicePermission": {
"opType": "save_audit_plan",
},
"id": "action:sql_management_conf_detail_enable_operator",
"projectArchived": false,
"projectManager": true,
"role": [
"admin",
"globalManager",
],
"type": "action",
},
"action:sql_management_conf_detail_stop_operator": {
"dbServicePermission": {
"opType": "save_audit_plan",
},
"id": "action:sql_management_conf_detail_stop_operator",
"projectArchived": false,
"projectManager": true,
"role": [
"admin",
"globalManager",
],
"type": "action",
},
"action:sql_management_conf_edit_operator": {
"dbServicePermission": {
"fieldName": "instance_id",
"opType": "save_audit_plan",
},
"id": "action:sql_management_conf_edit_operator",
"projectArchived": false,
"projectManager": true,
"role": [
"admin",
"globalManager",
],
"type": "action",
},
"action:sql_management_conf_enable_operator": {
"dbServicePermission": {
"fieldName": "instance_id",
"opType": "save_audit_plan",
},
"id": "action:sql_management_conf_enable_operator",
"projectArchived": false,
"projectManager": true,
"role": [
"admin",
"globalManager",
],
"type": "action",
},
"action:sql_management_conf_stop_operator": {
"dbServicePermission": {
"fieldName": "instance_id",
"opType": "save_audit_plan",
},
"id": "action:sql_management_conf_stop_operator",
"projectArchived": false,
"projectManager": true,
"role": [
"admin",
"globalManager",
],
"type": "action",
},
"action:sql_management_create_white_list": {
"id": "action:sql_management_create_white_list",
"projectArchived": false,
Expand Down Expand Up @@ -1078,6 +1209,59 @@ exports[`usePermission should match snapshot 2`] = `
],
"type": "action",
},
"action:version_management_add_operator": {
"id": "action:version_management_add_operator",
"projectArchived": false,
"projectManager": true,
"role": [
"admin",
"globalManager",
],
"type": "action",
},
"action:version_management_delete_operator": {
"id": "action:version_management_delete_operator",
"projectArchived": false,
"projectManager": true,
"role": [
"admin",
"globalManager",
],
"type": "action",
},
"action:version_management_deploy_operator": {
"dbServicePermission": {
"opType": "create_workflow",
},
"id": "action:version_management_deploy_operator",
"projectArchived": false,
"projectManager": true,
"role": [
"admin",
"globalManager",
],
"type": "action",
},
"action:version_management_edit_operator": {
"id": "action:version_management_edit_operator",
"projectArchived": false,
"projectManager": true,
"role": [
"admin",
"globalManager",
],
"type": "action",
},
"action:version_management_lock_operator": {
"id": "action:version_management_lock_operator",
"projectArchived": false,
"projectManager": true,
"role": [
"admin",
"globalManager",
],
"type": "action",
},
"action:white_list_creation": {
"id": "action:white_list_creation",
"projectArchived": false,
Expand Down
131 changes: 131 additions & 0 deletions packages/shared/lib/global/usePermission/permissionManifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -777,5 +777,136 @@ export const PERMISSION_MANIFEST: Record<
type: 'action',
projectManager: true,
role: [SystemRole.admin, SystemRole.globalManager]
},

// 版本管理
[PERMISSIONS.ACTIONS.SQLE.VERSION_MANAGEMENT.ADD]: {
id: PERMISSIONS.ACTIONS.SQLE.VERSION_MANAGEMENT.ADD,
type: 'action',
projectArchived: false,
projectManager: true,
role: [SystemRole.admin, SystemRole.globalManager]
},
[PERMISSIONS.ACTIONS.SQLE.VERSION_MANAGEMENT.EDIT]: {
id: PERMISSIONS.ACTIONS.SQLE.VERSION_MANAGEMENT.EDIT,
type: 'action',
projectArchived: false,
projectManager: true,
role: [SystemRole.admin, SystemRole.globalManager]
},
[PERMISSIONS.ACTIONS.SQLE.VERSION_MANAGEMENT.DELETE]: {
id: PERMISSIONS.ACTIONS.SQLE.VERSION_MANAGEMENT.DELETE,
type: 'action',
projectArchived: false,
projectManager: true,
role: [SystemRole.admin, SystemRole.globalManager]
},
[PERMISSIONS.ACTIONS.SQLE.VERSION_MANAGEMENT.LOCK]: {
id: PERMISSIONS.ACTIONS.SQLE.VERSION_MANAGEMENT.LOCK,
type: 'action',
projectArchived: false,
projectManager: true,
role: [SystemRole.admin, SystemRole.globalManager]
},
[PERMISSIONS.ACTIONS.SQLE.VERSION_MANAGEMENT.DEPLOY]: {
id: PERMISSIONS.ACTIONS.SQLE.VERSION_MANAGEMENT.DEPLOY,
type: 'action',
projectArchived: false,
projectManager: true,
dbServicePermission: {
opType: OpPermissionItemOpPermissionTypeEnum.create_workflow
},
role: [SystemRole.admin, SystemRole.globalManager]
},

//SQL管控配置
[PERMISSIONS.ACTIONS.SQLE.SQL_MANAGEMENT_CONF.CREATE]: {
id: PERMISSIONS.ACTIONS.SQLE.SQL_MANAGEMENT_CONF.CREATE,
type: 'action',
projectArchived: false
},
[PERMISSIONS.ACTIONS.SQLE.SQL_MANAGEMENT_CONF.EDIT]: {
id: PERMISSIONS.ACTIONS.SQLE.SQL_MANAGEMENT_CONF.EDIT,
type: 'action',
projectArchived: false,
projectManager: true,
role: [SystemRole.admin, SystemRole.globalManager],
dbServicePermission: {
fieldName: 'instance_id',
opType: OpPermissionItemOpPermissionTypeEnum.save_audit_plan
}
},
[PERMISSIONS.ACTIONS.SQLE.SQL_MANAGEMENT_CONF.STOP]: {
id: PERMISSIONS.ACTIONS.SQLE.SQL_MANAGEMENT_CONF.STOP,
type: 'action',
projectArchived: false,
projectManager: true,
role: [SystemRole.admin, SystemRole.globalManager],
dbServicePermission: {
fieldName: 'instance_id',
opType: OpPermissionItemOpPermissionTypeEnum.save_audit_plan
}
},
[PERMISSIONS.ACTIONS.SQLE.SQL_MANAGEMENT_CONF.ENABLE]: {
id: PERMISSIONS.ACTIONS.SQLE.SQL_MANAGEMENT_CONF.ENABLE,
type: 'action',
projectArchived: false,
projectManager: true,
role: [SystemRole.admin, SystemRole.globalManager],
dbServicePermission: {
fieldName: 'instance_id',
opType: OpPermissionItemOpPermissionTypeEnum.save_audit_plan
}
},
[PERMISSIONS.ACTIONS.SQLE.SQL_MANAGEMENT_CONF.DELETE]: {
id: PERMISSIONS.ACTIONS.SQLE.SQL_MANAGEMENT_CONF.DELETE,
type: 'action',
projectArchived: false,
projectManager: true,
role: [SystemRole.admin, SystemRole.globalManager],
dbServicePermission: {
fieldName: 'instance_id',
opType: OpPermissionItemOpPermissionTypeEnum.save_audit_plan
}
},
[PERMISSIONS.ACTIONS.SQLE.SQL_MANAGEMENT_CONF.DETAIL_AUDIT]: {
id: PERMISSIONS.ACTIONS.SQLE.SQL_MANAGEMENT_CONF.DETAIL_AUDIT,
type: 'action',
projectArchived: false,
projectManager: true,
role: [SystemRole.admin, SystemRole.globalManager],
dbServicePermission: {
opType: OpPermissionItemOpPermissionTypeEnum.save_audit_plan
}
},
[PERMISSIONS.ACTIONS.SQLE.SQL_MANAGEMENT_CONF.DETAIL_STOP]: {
id: PERMISSIONS.ACTIONS.SQLE.SQL_MANAGEMENT_CONF.DETAIL_STOP,
type: 'action',
projectArchived: false,
projectManager: true,
role: [SystemRole.admin, SystemRole.globalManager],
dbServicePermission: {
opType: OpPermissionItemOpPermissionTypeEnum.save_audit_plan
}
},
[PERMISSIONS.ACTIONS.SQLE.SQL_MANAGEMENT_CONF.DETAIL_ENABLE]: {
id: PERMISSIONS.ACTIONS.SQLE.SQL_MANAGEMENT_CONF.DETAIL_ENABLE,
type: 'action',
projectArchived: false,
projectManager: true,
role: [SystemRole.admin, SystemRole.globalManager],
dbServicePermission: {
opType: OpPermissionItemOpPermissionTypeEnum.save_audit_plan
}
},
[PERMISSIONS.ACTIONS.SQLE.SQL_MANAGEMENT_CONF.DETAIL_DELETE]: {
id: PERMISSIONS.ACTIONS.SQLE.SQL_MANAGEMENT_CONF.DETAIL_DELETE,
type: 'action',
projectArchived: false,
projectManager: true,
role: [SystemRole.admin, SystemRole.globalManager],
dbServicePermission: {
opType: OpPermissionItemOpPermissionTypeEnum.save_audit_plan
}
}
} as const;
18 changes: 18 additions & 0 deletions packages/shared/lib/global/usePermission/permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,24 @@ export const PERMISSIONS = {
},
DATA_SOURCE_COMPARISON: {
CREATE_MODIFIED_SQL_WORKFLOW: 'action:create_modified_sql_workflow'
},
VERSION_MANAGEMENT: {
ADD: 'action:version_management_add_operator',
EDIT: 'action:version_management_edit_operator',
DELETE: 'action:version_management_delete_operator',
LOCK: 'action:version_management_lock_operator',
DEPLOY: 'action:version_management_deploy_operator'
},
SQL_MANAGEMENT_CONF: {
CREATE: 'action:sql_management_conf_create_operator',
EDIT: 'action:sql_management_conf_edit_operator',
STOP: 'action:sql_management_conf_stop_operator',
ENABLE: 'action:sql_management_conf_enable_operator',
DELETE: 'action:sql_management_conf_delete_operator',
DETAIL_AUDIT: 'action:sql_management_conf_detail_audit_operator',
DETAIL_STOP: 'action:sql_management_conf_detail_stop_operator',
DETAIL_ENABLE: 'action:sql_management_conf_detail_enable_operator',
DETAIL_DELETE: 'action:sql_management_conf_detail_delete_operator'
}
}
}
Expand Down
Loading

0 comments on commit b11e7fd

Please sign in to comment.