mirror of https://github.com/jumpserver/jumpserver
修改bug
parent
7a73bd98d3
commit
8677b0d18d
|
@ -173,7 +173,7 @@ def get_user_host(username):
|
|||
try:
|
||||
user = User.objects.get(username=username)
|
||||
except ObjectDoesNotExist:
|
||||
return {'Error': 'username %s is not exist.' % username}, ['Error']
|
||||
return {'Error': ['0', "Username \033[1;31m%s\033[0m doesn't exist on Jumpserver." % username]}, ['Error']
|
||||
else:
|
||||
perm_all = user.permission_set.all()
|
||||
for perm in perm_all:
|
||||
|
|
|
@ -4,17 +4,16 @@ from jasset.models import Asset
|
|||
|
||||
|
||||
class Permission(models.Model):
|
||||
PERM_USER_TYPE_CHOICE = (
|
||||
('S', 'Super'),
|
||||
('C', 'Common'),
|
||||
USER_ROLE_CHOICES = (
|
||||
('SU', 'SuperUser'),
|
||||
('CU', 'CommonUser'),
|
||||
)
|
||||
user = models.ForeignKey(User)
|
||||
asset = models.ForeignKey(Asset)
|
||||
is_ldap = models.BooleanField(default=True)
|
||||
perm_user_type = models.CharField(choices=PERM_USER_TYPE_CHOICE,
|
||||
max_length=1,
|
||||
blank=True,
|
||||
null=True)
|
||||
role = models.CharField(choices=USER_ROLE_CHOICES,
|
||||
max_length=1,
|
||||
blank=True,
|
||||
null=True)
|
||||
|
||||
def __unicode__(self):
|
||||
return '%s_%s' % (self.user.username, self.asset.ip)
|
|
@ -11,9 +11,9 @@ class Group(models.Model):
|
|||
|
||||
class User(models.Model):
|
||||
USER_ROLE_CHOICES = (
|
||||
('SU', 'Super_User'),
|
||||
('GA', 'Group_Admin'),
|
||||
('CU', 'Common_User'),
|
||||
('SU', 'SuperUser'),
|
||||
('GA', 'GroupAdmin'),
|
||||
('CU', 'CommonUser'),
|
||||
)
|
||||
username = models.CharField(max_length=80, unique=True)
|
||||
password = models.CharField(max_length=100)
|
||||
|
|
Loading…
Reference in New Issue