Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
84610f2a
Commit
84610f2a
authored
May 21, 2019
by
BaiJiangJie
Committed by
老广
May 21, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Bugfix] 修改PermsModel抽象后的objects-bug (#2713)
* [Bugfix] 修改PermsModel抽象后的objects-bug * [Bugfix] 删除无用代码
parent
d906df5b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
5 deletions
+4
-5
asset_permission.py
apps/perms/models/asset_permission.py
+1
-1
base.py
apps/perms/models/base.py
+2
-1
remote_app_permission.py
apps/perms/models/remote_app_permission.py
+1
-3
No files found.
apps/perms/models/asset_permission.py
View file @
84610f2a
...
@@ -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"
))
...
...
apps/perms/models/base.py
View file @
84610f2a
...
@@ -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"
))
...
...
apps/perms/models/remote_app_permission.py
View file @
84610f2a
...
@@ -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
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment