Skip to content

Commit

Permalink
[proxyfs] Shift crequest middleware import to the top (#2979)
Browse files Browse the repository at this point in the history
  • Loading branch information
Harshg999 committed Sep 7, 2022
1 parent d0d3845 commit 895a4b2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion desktop/core/src/desktop/lib/fs/proxyfs.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import logging
import sys

from crequest.middleware import CrequestMiddleware
from useradmin.models import User

from desktop.auth.backend import is_admin
Expand Down Expand Up @@ -226,7 +227,6 @@ def create_home_dir(self, home_path=None):
# Try getting user from the request and create home dirs. This helps when Hue admin is trying to create the dir for other users.
# That way only Hue admin needs authorization to create for all Hue users and not each individual user.
# If normal users also have authorization, then they can also create the dir for themselves if they want.
from crequest.middleware import CrequestMiddleware
request = CrequestMiddleware.get_request()
username = request.user.username if request and hasattr(request, 'user') and request.user.is_authenticated else self.getuser()

Expand Down

0 comments on commit 895a4b2

Please sign in to comment.