pull/6/head
ibuler 10 years ago
parent 7a73bd98d3
commit 8677b0d18d

@ -173,7 +173,7 @@ def get_user_host(username):
try: try:
user = User.objects.get(username=username) user = User.objects.get(username=username)
except ObjectDoesNotExist: 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: else:
perm_all = user.permission_set.all() perm_all = user.permission_set.all()
for perm in perm_all: for perm in perm_all:

@ -4,14 +4,13 @@ from jasset.models import Asset
class Permission(models.Model): class Permission(models.Model):
PERM_USER_TYPE_CHOICE = ( USER_ROLE_CHOICES = (
('S', 'Super'), ('SU', 'SuperUser'),
('C', 'Common'), ('CU', 'CommonUser'),
) )
user = models.ForeignKey(User) user = models.ForeignKey(User)
asset = models.ForeignKey(Asset) asset = models.ForeignKey(Asset)
is_ldap = models.BooleanField(default=True) role = models.CharField(choices=USER_ROLE_CHOICES,
perm_user_type = models.CharField(choices=PERM_USER_TYPE_CHOICE,
max_length=1, max_length=1,
blank=True, blank=True,
null=True) null=True)

@ -11,9 +11,9 @@ class Group(models.Model):
class User(models.Model): class User(models.Model):
USER_ROLE_CHOICES = ( USER_ROLE_CHOICES = (
('SU', 'Super_User'), ('SU', 'SuperUser'),
('GA', 'Group_Admin'), ('GA', 'GroupAdmin'),
('CU', 'Common_User'), ('CU', 'CommonUser'),
) )
username = models.CharField(max_length=80, unique=True) username = models.CharField(max_length=80, unique=True)
password = models.CharField(max_length=100) password = models.CharField(max_length=100)

Loading…
Cancel
Save