mirror of https://github.com/jumpserver/jumpserver
				
				
				
			Merge pull request #3868 from jumpserver/dev_user
[Update] 修改用户ViewSet序列类返回的admin_orgs(解决组织管理员登录的Bug)pull/3871/head^2
						commit
						27ffed1be9
					
				| 
						 | 
				
			
			@ -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"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,7 +23,7 @@ class UserOrgSerializer(serializers.Serializer):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
class UserSerializer(BulkSerializerMixin, serializers.ModelSerializer):
 | 
			
		||||
    admin_orgs = UserOrgSerializer(many=True, read_only=True)
 | 
			
		||||
    admin_or_audit_orgs = UserOrgSerializer(many=True, read_only=True)
 | 
			
		||||
 | 
			
		||||
    class Meta:
 | 
			
		||||
        model = User
 | 
			
		||||
| 
						 | 
				
			
			@ -34,7 +34,7 @@ class UserSerializer(BulkSerializerMixin, serializers.ModelSerializer):
 | 
			
		|||
            'comment', 'source', 'is_valid', 'is_expired',
 | 
			
		||||
            'is_active', 'created_by', 'is_first_login',
 | 
			
		||||
            'date_password_last_updated', 'date_expired',
 | 
			
		||||
            'avatar_url', 'admin_orgs',
 | 
			
		||||
            'avatar_url', 'admin_or_audit_orgs',
 | 
			
		||||
        ]
 | 
			
		||||
        extra_kwargs = {
 | 
			
		||||
            'password': {'write_only': True, 'required': False, 'allow_null': True, 'allow_blank': True},
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue