-
Notifications
You must be signed in to change notification settings - Fork 1
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
Addition of contributor role to metamist permissions #703
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dancoates
force-pushed
the
contributor-role
branch
2 times, most recently
from
March 22, 2024 01:22
8135d4c
to
2c94fb6
Compare
dancoates
force-pushed
the
contributor-role
branch
from
April 10, 2024 06:25
1397b02
to
74d1942
Compare
dancoates
force-pushed
the
contributor-role
branch
from
June 3, 2024 05:27
74d1942
to
0e46a13
Compare
So best to limit the destructive updates in the migration and do them manually
This way they are accessible pretty much everywhere, but are only calculated once. The permission checks themselves are now synchronous and should be really fast, so no need for avoiding checking project ids
Also some QOL fixes for graphql types so that the context is now properly typed
dancoates
force-pushed
the
contributor-role
branch
from
June 14, 2024 06:53
f860318
to
e30590f
Compare
Rather than having these roles separately - incorportate them into project level roles where it makes sense. That way the same permission constructs can be used for checking admin roles rather than having to have separate ones.
even when running locally, it is better to lean on the actual access controls rather than allowing all access. This way we can catch issues with permission checks during development
to avoid listing absolutely every project for users with admin roles
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
Metamist currently has a fairly simple permission system. Each project defines a read group and a write group, these two groups define a list of group members. The members of the read group will have readonly access to the project, and the members of the write group have full unrestricted write access to the project.
Write actions within metamist are primarily performed programmatically via the API, but with some upcoming new features there will soon be the need to allow human users to perform a limited set of write actions. Some examples of these new features are:
We do not want to grant full write access to allow users to perform these actions, so it is necessary to create a more nuanced role based permissions system that allows limited access to certain write operations but restricts access to anything destructive.
Proposed Solution
We will keep the existing read and write permissions, as they are used extensively, and introduce a new contribute role that has limited write access. To achieve this we can introduce the concept of group roles, and migrate the existing read and write permissions to corresponding read and write roles, while also adding the new contribute role.
Types of roles
We will initially have 3 roles
With just these three roles they could be modeled as a hierarchical role system where each role inherits permissions from the last, ie.
contribute
inherits all permissions thatread
has. This model could cause problems in the future if we wanted to introduce more roles that don't directly fit into the hierarchical system. For example aneditor
role that allows for some write actions, but not the same ones ascontribute
.For this reason in this PR they are modeled as mutually exclusive roles and it is necessary to specify each role that is allowed to perform any given action. ie. if you want members of the write group to be able to perform read actions, then the
write
role will need to be listed as an allowed role.Database setup
The addition of roles requires a fairly minimal change to the database, just the addition of one new join table
project_groups
. The contains the join between a project and a group and the role that the group has within a project. It should look like: