mirror of https://github.com/jumpserver/jumpserver
[Bugfix] 修复首页显示问题
parent
c78107f62f
commit
0eda8865e6
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue