diff --git a/connect.py b/connect.py index 181784263..eecc38f4d 100755 --- a/connect.py +++ b/connect.py @@ -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: diff --git a/jpermission/models.py b/jpermission/models.py index 9b187c6a6..2d81a3461 100644 --- a/jpermission/models.py +++ b/jpermission/models.py @@ -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) \ No newline at end of file diff --git a/juser/models.py b/juser/models.py index c818185a5..26cc6c5d4 100644 --- a/juser/models.py +++ b/juser/models.py @@ -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)