Skip to content

Commit

Permalink
all file access to admin
Browse files Browse the repository at this point in the history
  • Loading branch information
Hrishikesh Jadhav committed Dec 6, 2023
1 parent 48162b0 commit 5f530e0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fileoperations/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ def get_shared_file_url(self, request, *args, **kwargs):
user_role = user.role_priv
user_org = user.org
self.lookup_field = "file"

if not self.check_file_ownership(request, kwargs.get("file")):
self.queryset = SharedFiles.objects.filter(shared_with__id=request.user.id)
response = self.retrieve(request, *args, **kwargs)
Expand All @@ -346,7 +346,7 @@ def get_shared_file_url(self, request, *args, **kwargs):
return response
else:
if(user_role == "org_admin"):
self.queryset = Objects.objects.prefetch_related("owner").filter(owner__org=user_org)
self.queryset = Objects.objects.select_related("owner").filter(owner__org=user_org)
else:
self.queryset = Objects.objects.filter(owner=user)
objs = get_object_or_404(self.queryset, id=kwargs.get("file"))
Expand Down

0 comments on commit 5f530e0

Please sign in to comment.