Commit 84610f2a authored by BaiJiangJie's avatar BaiJiangJie Committed by 老广

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

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

* [Bugfix] 删除无用代码
parent d906df5b
...@@ -33,7 +33,7 @@ class Action(models.Model): ...@@ -33,7 +33,7 @@ class Action(models.Model):
return cls.objects.get(name=PERMS_ACTION_NAME_ALL) 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")) 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")) 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")) system_users = models.ManyToManyField('assets.SystemUser', related_name='granted_by_permissions', verbose_name=_("System user"))
......
...@@ -5,6 +5,7 @@ import uuid ...@@ -5,6 +5,7 @@ import uuid
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.db import models from django.db import models
from django.utils import timezone from django.utils import timezone
from orgs.mixins import OrgModelMixin
from common.utils import date_expired_default, set_or_append_attr_bulk from common.utils import date_expired_default, set_or_append_attr_bulk
from orgs.mixins import OrgManager from orgs.mixins import OrgManager
...@@ -29,7 +30,7 @@ class BasePermissionManager(OrgManager): ...@@ -29,7 +30,7 @@ class BasePermissionManager(OrgManager):
return self.get_queryset().valid() return self.get_queryset().valid()
class BasePermission(models.Model): class BasePermission(OrgModelMixin):
id = models.UUIDField(default=uuid.uuid4, primary_key=True) id = models.UUIDField(default=uuid.uuid4, primary_key=True)
name = models.CharField(max_length=128, verbose_name=_('Name')) name = models.CharField(max_length=128, verbose_name=_('Name'))
users = models.ManyToManyField('users.User', blank=True, verbose_name=_("User")) users = models.ManyToManyField('users.User', blank=True, verbose_name=_("User"))
......
...@@ -4,8 +4,6 @@ ...@@ -4,8 +4,6 @@
from django.db import models from django.db import models
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from orgs.mixins import OrgModelMixin
from .base import BasePermission from .base import BasePermission
__all__ = [ __all__ = [
...@@ -13,7 +11,7 @@ __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")) remote_apps = models.ManyToManyField('applications.RemoteApp', related_name='granted_by_permissions', blank=True, verbose_name=_("RemoteApp"))
class Meta: class Meta:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment