2014-12-22 09:18:51 +00:00
|
|
|
from django.db import models
|
|
|
|
|
2014-12-22 15:14:29 +00:00
|
|
|
|
2015-01-10 05:35:56 +00:00
|
|
|
class UserGroup(models.Model):
|
2014-12-22 15:14:29 +00:00
|
|
|
name = models.CharField(max_length=80, unique=True)
|
|
|
|
comment = models.CharField(max_length=160, blank=True, null=True)
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.name
|
|
|
|
|
|
|
|
|
|
|
|
class User(models.Model):
|
|
|
|
USER_ROLE_CHOICES = (
|
2014-12-27 15:54:37 +00:00
|
|
|
('SU', 'SuperUser'),
|
|
|
|
('GA', 'GroupAdmin'),
|
|
|
|
('CU', 'CommonUser'),
|
2014-12-22 15:14:29 +00:00
|
|
|
)
|
|
|
|
username = models.CharField(max_length=80, unique=True)
|
|
|
|
password = models.CharField(max_length=100)
|
|
|
|
name = models.CharField(max_length=80)
|
|
|
|
email = models.EmailField(max_length=75, null=True, blank=True)
|
|
|
|
role = models.CharField(max_length=2, choices=USER_ROLE_CHOICES, default='CU')
|
2015-01-10 05:35:56 +00:00
|
|
|
user_group = models.ManyToManyField(UserGroup)
|
2014-12-22 15:14:29 +00:00
|
|
|
ldap_pwd = models.CharField(max_length=100)
|
2014-12-30 14:48:39 +00:00
|
|
|
ssh_key_pwd1 = models.CharField(max_length=100)
|
|
|
|
ssh_key_pwd2 = models.CharField(max_length=100)
|
|
|
|
ssh_pwd = models.CharField(max_length=100)
|
2014-12-22 15:14:29 +00:00
|
|
|
is_active = models.BooleanField(default=True)
|
|
|
|
last_login = models.IntegerField(default=0)
|
|
|
|
date_joined = models.IntegerField()
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.username
|