Skip to content

Commit

Permalink
Casts a repo object before checking permission
Browse files Browse the repository at this point in the history
fixes: pulp#5619
  • Loading branch information
git-hyagi committed Jul 22, 2024
1 parent 2c08679 commit fa9acc1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES/5619.bufix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed a bug where containers couldn't be built from repository versions when using RBAC.
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 fa9acc1

Please sign in to comment.