jumpserver/jperm/models.py

33 lines
1003 B
Python
Raw Normal View History

2014-12-22 15:17:28 +00:00
from django.db import models
2015-03-11 09:59:15 +00:00
from juser.models import UserGroup, DEPT
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):
2015-03-11 15:46:35 +00:00
user_group = models.ForeignKey(UserGroup)
2015-03-12 10:43:17 +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-03-23 14:57:19 +00:00
dept = models.ForeignKey(DEPT)
2015-02-06 10:39:20 +00:00
comment = models.CharField(blank=True, null=True, max_length=50)
2015-02-11 10:38:56 +00:00
def __unicode__(self):
return self.name
2015-02-06 10:39:20 +00:00
class SudoPerm(models.Model):
2015-02-09 10:50:21 +00:00
name = models.CharField(max_length=20)
user_runas = models.CharField(max_length=100)
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-11 10:38:56 +00:00
comment = models.CharField(max_length=30, null=True, blank=True)
def __unicode__(self):
return self.name