feat(rbac): allow tokens to create org invitations and storage backends#2710
Merged
jiparis merged 18 commits intochainloop-dev:mainfrom Feb 6, 2026
Merged
feat(rbac): allow tokens to create org invitations and storage backends#2710jiparis merged 18 commits intochainloop-dev:mainfrom
jiparis merged 18 commits intochainloop-dev:mainfrom
Conversation
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
jiparis
commented
Feb 5, 2026
| // 2.c - Set its user | ||
| usercontext.WithCurrentUserMiddleware(opts.UserUseCase, logHelper), | ||
| // Store all memberships in the context | ||
| usercontext.WithCurrentMembershipsMiddleware(opts.MembershipUseCase), |
Member
Author
There was a problem hiding this comment.
I just moved this earlier in the chain, so that membership is available to the middlewares in the next selector.
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
jiparis
commented
Feb 5, 2026
| } | ||
|
|
||
| // 3 - Check that the user is a member of the given org | ||
| // NOTE: this check is not necessary, as the user is already a member of the org |
Member
Author
There was a problem hiding this comment.
As the comment states, this is not needed since validation is done in the middleware layer already.
migmartri
previously approved these changes
Feb 5, 2026
| @@ -0,0 +1,2 @@ | |||
| -- Modify "org_invitations" table | |||
| ALTER TABLE "org_invitations" ALTER COLUMN "sender_id" DROP NOT NULL; | |||
Member
Author
There was a problem hiding this comment.
The sender is now optional (instance tokens are anonymous)
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
javirln
approved these changes
Feb 6, 2026
Collaborator
This file contains hidden or 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
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.

For easy onboarding, this PR includes the RBAC logic to allow Tokens with proper permissions to create organization invitations (initially only
InstanceAdminRole), and list and create storage backends.Also, for InstanceAdmin users, they will be allowed to invite users to orgs they don't belong to.
Some tests:
Organization invitations
With Instance admin token: 🟢
Then authenticate with the target user:
With Instance admin user: 🟢
With regular token: 🔴
With regular user (Org Member): 🔴
Same user trying to invite someone to an org he doesn't belong to (but exists):
With regular user (org admin): 🟢
Storage backends
Regular user (Org Owner): 🟢
Regular user (Org Viewer): 🔴
Regular user (Instance admin, not member of the target org): 🟢
Token (instance admin)⚠️
Without org:
With org: 🟢
Regular token: 🔴
Refs #2704