Skip to content

Commit ee90e09

Browse files
authored
Merge pull request #11341 from antkryt/hotfix/ENG-9064
[ENG-9064] When creating file guid through API, needs to work for people with read perms
2 parents 18ba62f + 2bc27c5 commit ee90e09

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

api/files/views.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
FileDetailSerializer,
3131
FileVersionSerializer,
3232
)
33-
from osf.utils.permissions import ADMIN
3433

3534

3635
class FileMixin:
@@ -87,11 +86,11 @@ def get_target(self):
8786

8887
# overrides RetrieveAPIView
8988
def get_object(self):
90-
user = utils.get_user_auth(self.request).user
9189
file = self.get_file()
9290

9391
if self.request.GET.get('create_guid', False):
94-
if (self.get_target().has_permission(user, ADMIN) and utils.has_admin_scope(self.request)):
92+
auth = utils.get_user_auth(self.request)
93+
if self.get_target().can_view(auth):
9594
file.get_guid(create=True)
9695

9796
# We normally would pass this through `get_file` as an annotation, but the `select_for_update` feature prevents

0 commit comments

Comments
 (0)