From b4cc2bbff9e0d42febcf866d81ad1eefc8ed1e4d Mon Sep 17 00:00:00 2001 From: Bai Date: Sat, 18 Apr 2020 01:22:48 +0800 Subject: [PATCH] =?UTF-8?q?[Bugfix]=20=E4=BF=AE=E5=A4=8D=E7=9C=9F=E5=AE=9E?= =?UTF-8?q?=E7=BB=84=E7=BB=87=E4=B8=8B=EF=BC=8C=E6=96=B0=E5=BB=BA=E7=9A=84?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E8=A7=92=E8=89=B2=E6=98=BE=E7=A4=BA=E4=B8=8D?= =?UTF-8?q?=E7=A8=B3=E5=AE=9A=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/users/api/user.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/users/api/user.py b/apps/users/api/user.py index fac0fabca..2670eb014 100644 --- a/apps/users/api/user.py +++ b/apps/users/api/user.py @@ -49,7 +49,12 @@ class UserViewSet(CommonApiMixin, UserQuerysetMixin, BulkModelViewSet): if isinstance(users, User): users = [users] if current_org and current_org.is_real(): - current_org.users.add(*users) + # current_org.users.add(*users) + # 如果在真实组织下创建用户,使用上面的语句会出现用户角色显示不稳定的问题 + # 可能是current_org的users add操作是进程不安全的 + # User Model 中的 remove 操作没有出现问题,暂时不做更改 + for user in users: + user.related_user_orgs.add(current_org.id) self.send_created_signal(users) def get_permissions(self):