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
c6d50802
Commit
c6d50802
authored
Jul 27, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Bugfix] Fix perm name unique
parent
f7fb36a1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
6 deletions
+5
-6
urls.py
apps/jumpserver/urls.py
+0
-3
forms.py
apps/perms/forms.py
+1
-2
models.py
apps/perms/models.py
+4
-1
No files found.
apps/jumpserver/urls.py
View file @
c6d50802
...
...
@@ -92,9 +92,6 @@ urlpatterns = [
url
(
r'^captcha/'
,
include
(
'captcha.urls'
)),
]
urlpatterns
+=
app_view_patterns
# urlpatterns = wrapper_patterns_with_org(urlpatterns)
urlpatterns
+=
static
(
settings
.
MEDIA_URL
,
document_root
=
settings
.
MEDIA_ROOT
)
\
+
static
(
settings
.
STATIC_URL
,
document_root
=
settings
.
STATIC_ROOT
)
...
...
apps/perms/forms.py
View file @
c6d50802
...
...
@@ -29,8 +29,7 @@ class AssetPermissionForm(OrgModelForm):
return
users_field
=
self
.
fields
.
get
(
'users'
)
if
hasattr
(
users_field
,
'queryset'
):
# users_field.queryset = User.objects.filter(orgs=current_org)
users_field
.
queryset
=
current_org
.
get_org_users
()
.
exclude
(
role
=
User
.
ROLE_APP
)
users_field
.
queryset
=
current_org
.
get_org_users
()
class
Meta
:
model
=
AssetPermission
...
...
apps/perms/models.py
View file @
c6d50802
...
...
@@ -25,7 +25,7 @@ class AssetPermissionManager(OrgManager):
class
AssetPermission
(
OrgModelMixin
):
id
=
models
.
UUIDField
(
default
=
uuid
.
uuid4
,
primary_key
=
True
)
name
=
models
.
CharField
(
max_length
=
128
,
unique
=
True
,
verbose_name
=
_
(
'Name'
))
name
=
models
.
CharField
(
max_length
=
128
,
verbose_name
=
_
(
'Name'
))
users
=
models
.
ManyToManyField
(
'users.User'
,
related_name
=
'asset_permissions'
,
blank
=
True
,
verbose_name
=
_
(
"User"
))
user_groups
=
models
.
ManyToManyField
(
'users.UserGroup'
,
related_name
=
'asset_permissions'
,
blank
=
True
,
verbose_name
=
_
(
"User group"
))
assets
=
models
.
ManyToManyField
(
'assets.Asset'
,
related_name
=
'granted_by_permissions'
,
blank
=
True
,
verbose_name
=
_
(
"Asset"
))
...
...
@@ -40,6 +40,9 @@ class AssetPermission(OrgModelMixin):
objects
=
AssetPermissionManager
.
from_queryset
(
AssetPermissionQuerySet
)()
class
Meta
:
unique_together
=
[(
'org_id'
,
'name'
)]
def
__str__
(
self
):
return
self
.
name
...
...
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