mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-07 02:10:23 +00:00
perf: 优化权限位 (#8110)
* perf: 优化权限位 * perf: 优化返回的组织 * perf: 保证结果是 ok * perf: 去掉 distinct * perf: tree count Co-authored-by: ibuler <ibuler@qq.com>
This commit is contained in:
@@ -2,6 +2,10 @@ from django.utils.translation import ugettext_noop
|
||||
|
||||
from .const import Scope, system_exclude_permissions, org_exclude_permissions
|
||||
|
||||
_view_root_perms = (
|
||||
('orgs', 'organization', 'view', 'rootorg'),
|
||||
)
|
||||
|
||||
# 工作台也区分组织后再考虑
|
||||
user_perms = (
|
||||
('rbac', 'menupermission', 'view', 'workbench'),
|
||||
@@ -21,19 +25,23 @@ system_user_perms = (
|
||||
('authentication', 'temptoken', 'add,change,view', 'temptoken'),
|
||||
('authentication', 'accesskey', '*', '*'),
|
||||
('tickets', 'ticket', 'view', 'ticket'),
|
||||
('orgs', 'organization', 'view', 'rootorg'),
|
||||
) + user_perms
|
||||
|
||||
auditor_perms = user_perms + (
|
||||
_auditor_perms = (
|
||||
('rbac', 'menupermission', 'view', 'audit'),
|
||||
('audits', '*', '*', '*'),
|
||||
('terminal', 'commandstorage', 'view', 'commandstorage'),
|
||||
('terminal', 'sessionreplay', 'view,download', 'sessionreplay'),
|
||||
('terminal', 'session', '*', '*'),
|
||||
('terminal', 'command', '*', '*'),
|
||||
('ops', 'commandexecution', 'view', 'commandexecution')
|
||||
('ops', 'commandexecution', 'view', 'commandexecution'),
|
||||
)
|
||||
|
||||
auditor_perms = user_perms + _auditor_perms
|
||||
|
||||
system_auditor_perms = system_user_perms + _auditor_perms + _view_root_perms
|
||||
|
||||
|
||||
app_exclude_perms = [
|
||||
('users', 'user', 'add,delete', 'user'),
|
||||
('orgs', 'org', 'add,delete,change', 'org'),
|
||||
@@ -101,7 +109,7 @@ class BuiltinRole:
|
||||
'1', ugettext_noop('SystemAdmin'), Scope.system, []
|
||||
)
|
||||
system_auditor = PredefineRole(
|
||||
'2', ugettext_noop('SystemAuditor'), Scope.system, auditor_perms
|
||||
'2', ugettext_noop('SystemAuditor'), Scope.system, system_auditor_perms
|
||||
)
|
||||
system_component = PredefineRole(
|
||||
'4', ugettext_noop('SystemComponent'), Scope.system, app_exclude_perms, 'exclude'
|
||||
|
Reference in New Issue
Block a user