jumpserver/jperm/models.py

32 lines
908 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 CMD(models.Model):
cmd = models.CharField(max_length=200)
class CmdGroup(models.Model):
name = models.CharField(max_length=50)
cmd = models.ForeignKey(CMD)
comment = models.CharField(blank=True, null=True, max_length=50)
class SudoPerm(models.Model):
user = models.CharField(max_length=100)
is_user_group = models.BooleanField(default=False)
asset = models.CharField(max_length=100)
is_asset_group = models.BooleanField(default=False)
cmd = models.CharField(max_length=200)
is_cmd_group = models.BooleanField(default=False)