From 5942037d812c227bbdc3f555ba8d1e532b0185b0 Mon Sep 17 00:00:00 2001 From: ibuler Date: Thu, 17 Mar 2022 14:15:14 +0800 Subject: [PATCH] perf: some perm to xpack --- apps/rbac/tree.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/apps/rbac/tree.py b/apps/rbac/tree.py index 6318242f3..9ba33930e 100644 --- a/apps/rbac/tree.py +++ b/apps/rbac/tree.py @@ -119,11 +119,14 @@ verbose_name_mapper = { } xpack_nodes = [ - 'xpack', 'tickets', 'applications.remoteapp', - "assets.accountbackupplan", "assets.accountbackupplanexecution", + 'xpack', 'tickets', 'gather_account_node', + 'applications.remoteapp', "assets.accountbackupplan", + "assets.accountbackupplanexecution", "rbac.orgrole", "rbac.orgrolebinding", - "settings.change_interface", 'assets.gathereduser', - 'gather_account_node' + 'assets.gathereduser', + + 'settings.change_interface', 'settings.change_sms', + 'users.invite_user', 'users.remove_user', ] @@ -316,12 +319,15 @@ class PermissionTreeUtil: model_id = f'{p.app}.{p.model}' if not self._check_model_xpack(model_id): continue + title = p.app_label_codename + if title in xpack_nodes: + continue + # name 要特殊处理,解决 i18n 问题 name, icon = self._get_permission_name_icon(p, content_types_name_mapper) if DEBUG_DB: name += '[{}]'.format(p.app_label_codename) - title = p.app_label_codename pid = model_id # perm node 的特殊设置用的是 title,因为 id 是数字,不一致 if title in special_pid_mapper: