Merge pull request #3869 from jumpserver/lina_user

[Update] 修改用户Profile序列类返回的admin_orgs
pull/3871/head
BaiJiangJie 2020-04-10 12:49:57 +08:00 committed by GitHub
commit 88fcf8dbd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 8 deletions

View File

@ -563,10 +563,10 @@ class User(AuthMixin, TokenMixin, RoleMixin, MFAMixin, AbstractUser):
user_default = settings.STATIC_URL + "img/avatar/user.png"
return user_default
def admin_orgs(self):
from orgs.models import Organization
orgs = Organization.get_user_admin_or_audit_orgs(self)
return orgs
# def admin_orgs(self):
# from orgs.models import Organization
# orgs = Organization.get_user_admin_or_audit_orgs(self)
# return orgs
def avatar_url(self):
admin_default = settings.STATIC_URL + "img/avatar/admin.png"

View File

@ -178,7 +178,7 @@ class ResetOTPSerializer(serializers.Serializer):
class UserProfileSerializer(serializers.ModelSerializer):
admin_orgs = UserOrgSerializer(many=True, read_only=True)
admin_or_audit_orgs = UserOrgSerializer(many=True, read_only=True)
class Meta:
model = User
@ -188,7 +188,5 @@ class UserProfileSerializer(serializers.ModelSerializer):
'comment', 'source', 'is_valid', 'is_expired',
'is_active', 'created_by', 'is_first_login',
'date_password_last_updated', 'date_expired',
'avatar_url',
'groups', 'admin_orgs',
'avatar_url', 'groups', 'admin_or_audit_orgs',
]