jumpserver/jperm/models.py

21 lines
597 B
Python
Raw Normal View History

2014-12-22 15:17:28 +00:00
from django.db import models
2015-01-26 16:14:50 +00:00
from juser.models import User, UserGroup
from jasset.models import Asset, BisGroup
2014-12-22 15:17:28 +00:00
2014-12-22 15:36:32 +00:00
2015-01-26 16:14:50 +00:00
class PermUser(models.Model):
2014-12-22 15:36:32 +00:00
user = models.ForeignKey(User)
asset = models.ForeignKey(Asset)
2015-01-26 16:14:50 +00:00
asset_group = models.ForeignKey(BisGroup)
2014-12-22 15:36:32 +00:00
def __unicode__(self):
2015-01-26 16:14:50 +00:00
return '%s_%s' % (self.user.username, self.asset.ip)
class PermUserGroup(models.Model):
group = models.ForeignKey(UserGroup)
asset = models.ForeignKey(Asset)
asset_group = models.ForeignKey(BisGroup)
def __unicode__(self):
return '%s_%s' % (self.group.name, self.asset.ip)