jumpserver/jperm/models.py

25 lines
812 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-27 07:01:09 +00:00
class Perm(models.Model):
user_group = models.ForeignKey(UserGroup)
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-02-06 10:39:20 +00:00
return '%s_%s' % (self.user_group.name, self.asset_group.name)
class CmdGroup(models.Model):
name = models.CharField(max_length=50)
2015-02-06 16:07:07 +00:00
cmd = models.CharField(max_length=999)
2015-02-06 10:39:20 +00:00
comment = models.CharField(blank=True, null=True, max_length=50)
class SudoPerm(models.Model):
2015-02-09 10:50:21 +00:00
name = models.CharField(max_length=20)
2015-02-06 16:07:07 +00:00
user_group = models.ManyToManyField(UserGroup)
asset_group = models.ManyToManyField(BisGroup)
cmd_group = models.ManyToManyField(CmdGroup)
2015-02-09 10:50:21 +00:00
comment = models.CharField(max_length=30, null=True, blank=True)