Skip to content

Commit

Permalink
fix: 修复requset.user为None报错问题 #1464
Browse files Browse the repository at this point in the history
  • Loading branch information
huangpixu committed Feb 24, 2025
1 parent 28ded14 commit 2f4e4b5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions itsm/component/misc_middlewares.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ class WikiIamAuthMiddleware(MiddlewareMixin):

def process_view(self, request, view, args, kwargs):
"""process_view."""
if request.user.username and "/wiki/" in request.path:
if request.user and request.user.username and "/wiki/" in request.path:
apply_actions = ["knowledge_manage"]
iam_client = IamRequest(request)
auth_actions = iam_client.resource_multi_actions_allowed(apply_actions, [])
Expand All @@ -264,7 +264,7 @@ class HttpsMiddleware(MiddlewareMixin):
def process_request(self, request):
if settings.ENVIRONMENT == "dev":
return None

if settings.RUN_VER == "ieod":
# 对于openapi 跳转豁免
if request.path.startswith(EXEMPT_HTTPS_REDIRECT):
Expand Down

0 comments on commit 2f4e4b5

Please sign in to comment.