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
0eda8865
Commit
0eda8865
authored
Sep 12, 2018
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Bugfix] 修复首页显示问题
parent
c78107f6
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
2 additions
and
4 deletions
+2
-4
permissions.py
apps/common/permissions.py
+0
-2
views.py
apps/jumpserver/views.py
+2
-0
mixins.py
apps/orgs/mixins.py
+0
-2
No files found.
apps/common/permissions.py
View file @
0eda8865
...
...
@@ -86,9 +86,7 @@ class AdminUserRequiredMixin(UserPassesTestMixin):
return
redirect
(
'orgs:switch-a-org'
)
if
not
current_org
.
can_admin_by
(
request
.
user
):
print
(
"{} cannot admin {}"
.
format
(
request
.
user
,
current_org
))
if
request
.
user
.
is_org_admin
:
print
(
"Is org admin"
)
return
redirect
(
'orgs:switch-a-org'
)
return
HttpResponseForbidden
()
return
super
()
.
dispatch
(
request
,
*
args
,
**
kwargs
)
...
...
apps/jumpserver/views.py
View file @
0eda8865
...
...
@@ -28,6 +28,8 @@ class IndexView(LoginRequiredMixin, TemplateView):
return
self
.
handle_no_permission
()
if
not
request
.
user
.
is_org_admin
:
return
redirect
(
'assets:user-asset-list'
)
if
not
current_org
or
not
current_org
.
can_admin_by
(
request
.
user
):
return
redirect
(
'orgs:switch-a-org'
)
return
super
(
IndexView
,
self
)
.
dispatch
(
request
,
*
args
,
**
kwargs
)
@staticmethod
...
...
apps/orgs/mixins.py
View file @
0eda8865
...
...
@@ -148,14 +148,12 @@ class OrgModelMixin(models.Model):
class
OrgViewGenericMixin
:
def
dispatch
(
self
,
request
,
*
args
,
**
kwargs
):
print
(
"Current org: {}"
.
format
(
current_org
))
if
not
current_org
:
return
redirect
(
'orgs:switch-a-org'
)
if
not
current_org
.
can_admin_by
(
request
.
user
):
print
(
"{} cannot admin {}"
.
format
(
request
.
user
,
current_org
))
if
request
.
user
.
is_org_admin
:
print
(
"Is org admin"
)
return
redirect
(
'orgs:switch-a-org'
)
return
HttpResponseForbidden
()
else
:
...
...
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