From ae5487720cd4ac924e922666b6691f353b3a2948 Mon Sep 17 00:00:00 2001 From: ibuler Date: Mon, 21 Mar 2022 17:44:17 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=8E=BB=E6=8E=89=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/users/models/user.py | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/apps/users/models/user.py b/apps/users/models/user.py index 91306f7ac..0229067d5 100644 --- a/apps/users/models/user.py +++ b/apps/users/models/user.py @@ -308,22 +308,6 @@ class RoleMixin: def is_superuser(self, value): self._is_superuser = value self._update_superuser = True - # from rbac.models import SystemRoleBinding - # from rbac.builtin import BuiltinRole - # role = BuiltinRole.system_admin.get_role() - # - # kwargs = {'user_id': self.id, 'role_id': role.id, 'scope': 'system'} - # exists = SystemRoleBinding.objects.filter(**kwargs).exists() - # print("kwargs: ", kwargs) - # print("Exist: ", exists) - # # 需要添加并且不存在 - # if value and not exists: - # transaction.on_commit(lambda: SystemRoleBinding.objects.create(**kwargs)) - # # 需要删除并且存在 - # elif not value and exists: - # transaction.on_commit(lambda: SystemRoleBinding.objects.filter(**kwargs).delete()) - # else: - # print("No need operate") @lazyproperty def is_org_admin(self):