[Bugfix] 修改PermsModel抽象后的objects-bug (#2713)

* [Bugfix] 修改PermsModel抽象后的objects-bug

* [Bugfix] 删除无用代码
pull/2714/head
BaiJiangJie 2019-05-21 17:01:47 +08:00 committed by 老广
parent d906df5b00
commit 84610f2a2c
3 changed files with 4 additions and 5 deletions

View File

@ -33,7 +33,7 @@ class Action(models.Model):
return cls.objects.get(name=PERMS_ACTION_NAME_ALL)
class AssetPermission(OrgModelMixin, BasePermission):
class AssetPermission(BasePermission):
assets = models.ManyToManyField('assets.Asset', related_name='granted_by_permissions', blank=True, verbose_name=_("Asset"))
nodes = models.ManyToManyField('assets.Node', related_name='granted_by_permissions', blank=True, verbose_name=_("Nodes"))
system_users = models.ManyToManyField('assets.SystemUser', related_name='granted_by_permissions', verbose_name=_("System user"))

View File

@ -5,6 +5,7 @@ import uuid
from django.utils.translation import ugettext_lazy as _
from django.db import models
from django.utils import timezone
from orgs.mixins import OrgModelMixin
from common.utils import date_expired_default, set_or_append_attr_bulk
from orgs.mixins import OrgManager
@ -29,7 +30,7 @@ class BasePermissionManager(OrgManager):
return self.get_queryset().valid()
class BasePermission(models.Model):
class BasePermission(OrgModelMixin):
id = models.UUIDField(default=uuid.uuid4, primary_key=True)
name = models.CharField(max_length=128, verbose_name=_('Name'))
users = models.ManyToManyField('users.User', blank=True, verbose_name=_("User"))

View File

@ -4,8 +4,6 @@
from django.db import models
from django.utils.translation import ugettext_lazy as _
from orgs.mixins import OrgModelMixin
from .base import BasePermission
__all__ = [
@ -13,7 +11,7 @@ __all__ = [
]
class RemoteAppPermission(OrgModelMixin, BasePermission):
class RemoteAppPermission(BasePermission):
remote_apps = models.ManyToManyField('applications.RemoteApp', related_name='granted_by_permissions', blank=True, verbose_name=_("RemoteApp"))
class Meta: