Skip to content

Commit

Permalink
Casts a repo object before checking permission
Browse files Browse the repository at this point in the history
fixes: #5619
(cherry picked from commit 93f241f)
  • Loading branch information
git-hyagi authored and mdellweg committed Jul 23, 2024
1 parent b892d4b commit 1e3d238
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGES/5619.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fixed a bug in `has_repo_or_repo_ver_param_model_or_obj_perms` function to make
it work with plugin Repositories.
4 changes: 2 additions & 2 deletions pulpcore/app/global_access_conditions.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,9 +479,9 @@ def has_repo_or_repo_ver_param_model_or_obj_perms(request, view, action, permiss
)
serializer.is_valid(raise_exception=True)
if repository := serializer.validated_data.get("repository"):
return request.user.has_perm(permission, repository)
return request.user.has_perm(permission, repository.cast())
elif repo_ver := serializer.validated_data.get("repository_version"):
return request.user.has_perm(permission, repo_ver.repository)
return request.user.has_perm(permission, repo_ver.repository.cast())
return True


Expand Down

0 comments on commit 1e3d238

Please sign in to comment.