Skip to content

Conversation

@krauselukas
Copy link
Contributor

  • The policy doesn't check if the assigner is authorized to add an assignee to a package. As of now everyone can add an assignee. We have to check if the assigner is a collaborator as well.
  • Right now we show the assignment option to every user. We should only show it if the user is actually authorized to assign someone.

The policy doesn't check if the assigner is authorized to add
an assignee to a package. As of now everyone can add an assigne.
We have to check if the assigner is a collaborator as well.
@krauselukas krauselukas added the Frontend Things related to the OBS RoR app label Nov 6, 2025
Right now we show the assignment option to every user. We should only
show it if the user is actually authorized to assign someone.
@krauselukas krauselukas force-pushed the fix/show_assignment_option_authorization branch from f92bd5e to e6026eb Compare November 6, 2025 17:17
return true if user.admin?
return false unless assigneer_is_a_collaborator?

record.assignee_is_a_collaborator?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct me if I'm wrong:
We check the assigner is a collaborator and can indeed assign someone, that's right.
But then we check we can only assign collaborators.
So in the end this only allow collaborators to assign other collaborators, is this how it should be?

Comment on lines +71 to +76
def assigneer_is_a_collaborator?
collaborators = (record.relationships + record.project.relationships).map(&:user)
return false if collaborators.empty?

collaborators.include?(user)
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be moved into User, that way you can reuse it for this and for the AssignmentPolicy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Frontend Things related to the OBS RoR app

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants