You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jumpserver/jperm/models.py

46 lines
1.5 KiB

import datetime
from django.db import models
from jasset.models import Asset, AssetGroup
9 years ago
from juser.models import User, UserGroup
9 years ago
class PermLog(models.Model):
datetime = models.DateTimeField(auto_now_add=True)
9 years ago
action = models.CharField(max_length=100, null=True, blank=True, default='')
results = models.CharField(max_length=1000, null=True, blank=True, default='')
is_success = models.BooleanField(default=False)
is_finish = models.BooleanField(default=False)
9 years ago
class SysUser(models.Model):
username = models.CharField(max_length=100)
password = models.CharField(max_length=100)
comment = models.CharField(max_length=100, null=True, blank=True, default='')
9 years ago
class PermRole(models.Model):
name = models.CharField(max_length=100)
comment = models.CharField(max_length=100)
class UserMapping(models.Model):
role = models.ForeignKey(PermRole, related_name='user_mapping')
user = models.ForeignKey(User, related_name='user_mapping')
asset = models.ForeignKey(Asset, related_name='user_mapping')
asset_group = models.ForeignKey(AssetGroup, related_name='user_mapping', null=True, blank=True)
class GroupMapping(models.Model):
role = models.ForeignKey(PermRole, related_name='group_mapping')
usergroup = models.ForeignKey(UserGroup, related_name='group_mapping', null=True, blank=True)
asset = models.ForeignKey(Asset, related_name='group_mapping')
asset_group = models.ForeignKey(AssetGroup, related_name='group_mapping', null=True, blank=True)