fix: 组件角色绑定错误

pull/8645/head
feng626 2022-07-21 15:31:56 +08:00 committed by 老广
parent 046356728a
commit 36d0b8d085
1 changed files with 6 additions and 1 deletions

View File

@ -16,9 +16,14 @@ class OrgRoleMixin:
def add_member(self, user, role=None):
from rbac.builtin import BuiltinRole
from .utils import tmp_to_org
role_id = BuiltinRole.org_user.id
if role:
role_id = role.id
elif user.is_service_account:
role_id = BuiltinRole.system_component.id
else:
role_id = BuiltinRole.org_user.id
with tmp_to_org(self):
defaults = {
'user': user, 'role_id': role_id,