jumpserver/jperm/models.py

42 lines
1.2 KiB
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-02-11 10:38:56 +00:00
name = models.CharField(max_length=100)
user_group = models.ManyToManyField(UserGroup)
asset_group = models.ManyToManyField(BisGroup)
comment = models.CharField(max_length=100)
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)
2015-03-11 09:59:15 +00:00
class DeptPerm(models.Model):
dept = models.ForeignKey(DEPT)
asset = models.ForeignKey(Asset)
def __unicode__(self):
return '%s_%s' % (self.dept.name, self.asset.ip)
2015-02-06 10:39:20 +00:00
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)
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