jumpserver/jperm/models.py

19 lines
552 B
Python
Raw Normal View History

2014-12-22 15:17:28 +00:00
from django.db import models
2014-12-22 15:36:32 +00:00
from juser.models import User
from jasset.models import Asset
2014-12-22 15:17:28 +00:00
2014-12-22 15:36:32 +00:00
class Permission(models.Model):
2014-12-27 15:54:37 +00:00
USER_ROLE_CHOICES = (
('SU', 'SuperUser'),
('CU', 'CommonUser'),
2014-12-22 15:36:32 +00:00
)
user = models.ForeignKey(User)
asset = models.ForeignKey(Asset)
2014-12-27 15:54:37 +00:00
role = models.CharField(choices=USER_ROLE_CHOICES,
2014-12-27 16:04:00 +00:00
max_length=2,
2014-12-27 15:54:37 +00:00
blank=True,
null=True)
2014-12-22 15:36:32 +00:00
def __unicode__(self):
return '%s_%s' % (self.user.username, self.asset.ip)