mirror of
https://github.com/jumpserver/jumpserver.git
synced 2026-01-15 14:47:24 +00:00
[Update] 修改一些逻辑
This commit is contained in:
@@ -4,10 +4,12 @@ import uuid
|
||||
from django.db import models, IntegrityError
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from orgs.mixins import OrgModelMixin
|
||||
|
||||
__all__ = ['UserGroup']
|
||||
|
||||
|
||||
class UserGroup(models.Model):
|
||||
class UserGroup(OrgModelMixin):
|
||||
id = models.UUIDField(default=uuid.uuid4, primary_key=True)
|
||||
name = models.CharField(max_length=128, unique=True, verbose_name=_('Name'))
|
||||
comment = models.TextField(blank=True, verbose_name=_('Comment'))
|
||||
|
||||
@@ -220,11 +220,10 @@ class User(AbstractUser):
|
||||
if self.username == 'admin':
|
||||
self.role = 'Admin'
|
||||
self.is_active = True
|
||||
instance = super().save(*args, **kwargs)
|
||||
super().save(*args, **kwargs)
|
||||
current_org = get_current_org()
|
||||
if current_org and current_org.is_real():
|
||||
instance.orgs.add(current_org)
|
||||
return instance
|
||||
self.orgs.add(current_org)
|
||||
|
||||
@property
|
||||
def private_token(self):
|
||||
|
||||
Reference in New Issue
Block a user