Skip to content

feat: rewrite permission logic to no permissions having lowest priority #86

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

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

gdiepen
Copy link
Contributor

@gdiepen gdiepen commented Mar 10, 2025

Instead of giving NO_PERMISSIONS a higher priority than all the other priorities, which allows for weird blocking of access if you have both MANAGE PERMISSIONS as well as NO_PERMISSIONS, this PR will modify the permission logic to be giving you the access of the highest allowed permissions based on the default permission, your user permissions, as well as each of your groups permissions.

In order to check what the type is that gave you access, we start with type fallback, then if the user permission prioerity is strictly higher than the fallback one, we change the type to user and if after that any of the group permissions have a strictly higher priority, we consider the group to be the type that granted this access.

For example, if the default permission is READ and your user also has explicit READ permissions, we consider the type to still be fallback (the fact that the user has read access does not grant anything additional above the defaults).

By using this logic and assigning NO_PERMISSIONS the lowest priority, you automatically solve the problem that if you are a member of two groups and one group gives you MANAGE access and the other one NO PERMISSIONS, you end up with no permissions in the current state (in the state with this pr, you would end up with MANAGE).

Because of the changes in this PR, this also Implements #80

This also might address #83, though without the use of an extra config variable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant