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
30392846
Commit
30392846
authored
Jul 27, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Bugfix] 修复校验失败api
parent
c6d50802
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
9 deletions
+11
-9
mixins.py
apps/orgs/mixins.py
+7
-1
api.py
apps/perms/api.py
+2
-1
asset_permission_list.html
apps/perms/templates/perms/asset_permission_list.html
+0
-2
views.py
apps/perms/views.py
+2
-5
No files found.
apps/orgs/mixins.py
View file @
30392846
...
@@ -10,7 +10,7 @@ from django.forms import ModelForm
...
@@ -10,7 +10,7 @@ from django.forms import ModelForm
from
django.http.response
import
HttpResponseForbidden
from
django.http.response
import
HttpResponseForbidden
from
common.utils
import
get_logger
from
common.utils
import
get_logger
from
.utils
import
current_org
,
set_current_org
from
.utils
import
current_org
,
set_current_org
,
set_to_root_org
from
.models
import
Organization
from
.models
import
Organization
logger
=
get_logger
(
__file__
)
logger
=
get_logger
(
__file__
)
...
@@ -85,6 +85,12 @@ class OrgViewGenericMixin:
...
@@ -85,6 +85,12 @@ class OrgViewGenericMixin:
return
super
()
.
dispatch
(
request
,
*
args
,
**
kwargs
)
return
super
()
.
dispatch
(
request
,
*
args
,
**
kwargs
)
class
RootOrgViewMixin
:
def
dispatch
(
self
,
request
,
*
args
,
**
kwargs
):
set_to_root_org
()
return
super
()
.
dispatch
(
request
,
*
args
,
**
kwargs
)
class
OrgModelForm
(
ModelForm
):
class
OrgModelForm
(
ModelForm
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
()
.
__init__
(
*
args
,
**
kwargs
)
super
()
.
__init__
(
*
args
,
**
kwargs
)
...
...
apps/perms/api.py
View file @
30392846
...
@@ -9,6 +9,7 @@ from rest_framework.pagination import LimitOffsetPagination
...
@@ -9,6 +9,7 @@ from rest_framework.pagination import LimitOffsetPagination
from
common.utils
import
set_or_append_attr_bulk
,
get_object_or_none
from
common.utils
import
set_or_append_attr_bulk
,
get_object_or_none
from
common.permissions
import
IsValidUser
,
IsOrgAdmin
,
IsOrgAdminOrAppUser
from
common.permissions
import
IsValidUser
,
IsOrgAdmin
,
IsOrgAdminOrAppUser
from
orgs.mixins
import
RootOrgViewMixin
from
.utils
import
AssetPermissionUtil
from
.utils
import
AssetPermissionUtil
from
.models
import
AssetPermission
from
.models
import
AssetPermission
from
.hands
import
AssetGrantedSerializer
,
User
,
UserGroup
,
Asset
,
Node
,
\
from
.hands
import
AssetGrantedSerializer
,
User
,
UserGroup
,
Asset
,
Node
,
\
...
@@ -236,7 +237,7 @@ class UserGroupGrantedNodeAssetsApi(ListAPIView):
...
@@ -236,7 +237,7 @@ class UserGroupGrantedNodeAssetsApi(ListAPIView):
return
assets
return
assets
class
ValidateUserAssetPermissionView
(
APIView
):
class
ValidateUserAssetPermissionView
(
RootOrgViewMixin
,
APIView
):
permission_classes
=
(
IsOrgAdminOrAppUser
,)
permission_classes
=
(
IsOrgAdminOrAppUser
,)
@staticmethod
@staticmethod
...
...
apps/perms/templates/perms/asset_permission_list.html
View file @
30392846
...
@@ -247,12 +247,10 @@ function initTree() {
...
@@ -247,12 +247,10 @@ function initTree() {
value
[
"iconSkin"
]
=
value
[
"is_node"
]
?
null
:
'file'
;
value
[
"iconSkin"
]
=
value
[
"is_node"
]
?
null
:
'file'
;
});
});
zNodes
=
data
;
zNodes
=
data
;
{
#
$
.
fn
.
zTree
.
init
(
$
(
"#assetTree"
),
setting
);
#
}
$
.
fn
.
zTree
.
init
(
$
(
"#assetTree"
),
setting
,
zNodes
);
$
.
fn
.
zTree
.
init
(
$
(
"#assetTree"
),
setting
,
zNodes
);
zTree
=
$
.
fn
.
zTree
.
getZTreeObj
(
"assetTree"
);
zTree
=
$
.
fn
.
zTree
.
getZTreeObj
(
"assetTree"
);
var
root
=
zTree
.
getNodes
()[
0
];
var
root
=
zTree
.
getNodes
()[
0
];
zTree
.
expandNode
(
root
);
zTree
.
expandNode
(
root
);
{
#
selectQueryNode
();
#
}
});
});
}
}
...
...
apps/perms/views.py
View file @
30392846
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
from
__future__
import
unicode_literals
,
absolute_import
from
__future__
import
unicode_literals
,
absolute_import
from
django.utils.translation
import
ugettext
as
_
from
django.utils.translation
import
ugettext
as
_
from
django.views.generic
import
ListView
,
CreateView
,
UpdateView
,
DetailView
from
django.views.generic
import
ListView
,
CreateView
,
UpdateView
,
DetailView
,
TemplateView
from
django.views.generic.edit
import
DeleteView
,
SingleObjectMixin
from
django.views.generic.edit
import
DeleteView
,
SingleObjectMixin
from
django.urls
import
reverse_lazy
from
django.urls
import
reverse_lazy
from
django.conf
import
settings
from
django.conf
import
settings
...
@@ -15,11 +15,8 @@ from .models import AssetPermission
...
@@ -15,11 +15,8 @@ from .models import AssetPermission
from
.forms
import
AssetPermissionForm
from
.forms
import
AssetPermissionForm
class
AssetPermissionListView
(
AdminUserRequiredMixin
,
ListView
):
class
AssetPermissionListView
(
AdminUserRequiredMixin
,
TemplateView
):
model
=
AssetPermission
template_name
=
'perms/asset_permission_list.html'
template_name
=
'perms/asset_permission_list.html'
paginate_by
=
settings
.
DISPLAY_PER_PAGE
user
=
user_group
=
asset
=
node
=
system_user
=
q
=
""
def
get_context_data
(
self
,
**
kwargs
):
def
get_context_data
(
self
,
**
kwargs
):
context
=
{
context
=
{
...
...
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