Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: group and user has at least 1 project owner counter respects multirole project groups #8453

Merged
merged 1 commit into from
Oct 16, 2024

Conversation

daveleek
Copy link
Contributor

Sometimes when a project had an owner and a group that has Owner role together with other roles you couldn't remove the owner access for the group.

The workaround were to remove the other group roles first, then you could remove the owner role when it was the only role left for the group in the project (given that any other group or user had owner role)

The reason was that we were checking an aggregated roleId property on the group roles returned object, which is set by a reduce function to be the first row of group ids returned from the db query. If any other role than 'Owner' was set as roleId, that group wasn't counted by the atleastOneOwner verification and if there was only 1 other 'Owner' on the project then the operation wasn't allowed.

Fixed this by removing the property altogether and check the roles property instead, which contains all roles the group has

Copy link
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Manifest Files

Copy link

vercel bot commented Oct 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
unleash-monorepo-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 15, 2024 1:49pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
unleash-docs ⬜️ Ignored (Inspect) Oct 15, 2024 1:49pm

Copy link
Contributor

@gastonfournier gastonfournier left a comment

Choose a reason for hiding this comment

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

Well done! Tricky issue indeed!

@daveleek daveleek requested a review from sighphyre October 16, 2024 06:24
@daveleek daveleek merged commit bb800e3 into main Oct 16, 2024
13 checks passed
@daveleek daveleek deleted the fix/groups-not-always-counted-as-owner-when-deleting branch October 16, 2024 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants