2015-03-26 10:42:52 +00:00
|
|
|
import datetime
|
|
|
|
|
2015-04-02 10:32:43 +00:00
|
|
|
from uuidfield import UUIDField
|
|
|
|
|
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-03-25 10:45:55 +00:00
|
|
|
user_group = models.ForeignKey(UserGroup)
|
2015-02-09 16:21:08 +00:00
|
|
|
user_runas = models.CharField(max_length=100)
|
2015-02-06 16:07:07 +00:00
|
|
|
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):
|
2015-04-02 12:40:54 +00:00
|
|
|
return self.user_group.name return self.name
|
2015-03-26 10:42:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Apply(models.Model):
|
2015-04-02 10:32:43 +00:00
|
|
|
uuid = UUIDField(auto=True)
|
2015-03-26 10:42:52 +00:00
|
|
|
applyer = models.CharField(max_length=20)
|
|
|
|
approver = models.CharField(max_length=20)
|
|
|
|
dept = models.CharField(max_length=20)
|
|
|
|
bisgroup = models.CharField(max_length=500)
|
|
|
|
asset = models.CharField(max_length=500)
|
|
|
|
comment = models.TextField(blank=True, null=True)
|
2015-04-01 10:58:10 +00:00
|
|
|
status = models.IntegerField(max_length=2)
|
2015-03-26 10:42:52 +00:00
|
|
|
date_add = models.DateTimeField(default=datetime.datetime.now(), null=True)
|
|
|
|
date_end = models.DateTimeField(null=True)
|
|
|
|
|
|
|
|
def __unicode__(self):
|
|
|
|
return self.applyer
|