-
Notifications
You must be signed in to change notification settings - Fork 622
feat(permissions): align project roles with UI access #2095
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
brynne8
wants to merge
24
commits into
looplj:unstable
Choose a base branch
from
brynne8:feat/project-permission-ui
base: unstable
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
2908be6
feat(permissions): align project roles with UI access
brynne8 1f2cc17
fix(permissions): preserve legacy invitation access
brynne8 bed9227
fix(permissions): preserve legacy invitation scope
brynne8 5e06dfe
test(migration): cover viewer prompt permissions
brynne8 f4e7861
fix(invitations): grant legacy invitees read access
brynne8 41410b1
fix(invitations): backfill legacy invitation roles
brynne8 11c31b2
fix(invitations): default legacy invites to developer
brynne8 a2ae73f
docs(invitations): document exported permission types
brynne8 52810ec
fix(migration): skip revoked legacy invitations
brynne8 4bd1b0c
fix: add default pagination for useRoles hook
brynne8 daa5e1c
fix: restore soft-deleted Developer role in beta7 migration
brynne8 6a289db
fix: extract numeric ID from global ID for invitation role
brynne8 3e0faa6
fix: prevent deleting Developer role and clear stale UserRole on restore
brynne8 80d7502
refactor: remove soft-delete restoration for Developer role
brynne8 dfe8995
fix: clean up soft-deleted Developer roles and recreate with default …
brynne8 d3a09ac
fix(permissions): enforce project role access
brynne8 d8b55c8
fix(migration): preserve unrelated deleted roles
brynne8 01bdaad
fix(api-keys): restrict project key creation to admins
brynne8 b46b3eb
fix(permissions): align Developer role defaults and model access
brynne8 cb285ed
fix(migration): preserve roles during invitation backfill
brynne8 9531ceb
Revert "fix(migration): preserve roles during invitation backfill"
brynne8 d63b937
fix(migration): skip invalid legacy invitations
brynne8 481b774
chore: resolve conflicts with unstable
brynne8 11bc1a0
fix(apikeys): avoid unauthorized project template field
brynne8 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| # Permission And UI Plan | ||
|
|
||
| ## Goals | ||
|
|
||
| - Project roles grant usable project access without requiring system scopes. | ||
| - The server publishes effective project scopes so API authorization, routes, menus, and controls share one source of truth. | ||
| - Read permission shows information; write permission alone exposes mutation controls. | ||
| - Project members select from project-approved, enabled models without viewing global Channel configuration. | ||
|
|
||
| ## Role Presets | ||
|
|
||
| New projects create these project roles. Invitations bind to a concrete project role when created. | ||
|
|
||
| | Role | Scope set | Intended use | | ||
| | --- | --- | --- | | ||
| | Project Admin | `read/write_users`, `read/write_roles`, `read/write_api_keys`, `read/write_prompts`, `read/write_requests` | Manage the project, its members, and its resources. | | ||
| | Developer | `read/write_api_keys`, `read/write_prompts`, `write_requests` | Use the project, manage API keys and prompts, and use Playground. Personal request visibility is not treated as project-wide request access. | | ||
| | Viewer | `read_prompts`, `read_requests` | Inspect permitted project data without changing it. | | ||
|
|
||
| System Channels, Models, Data Storage, Settings, and global analytics remain system-level resources. A project role never receives `read_channels` or `write_channels` merely to use Playground. | ||
|
|
||
| ## Authorization Contract | ||
|
|
||
| 1. `UserProjectInfo.effectiveScopes` is the union of direct membership scopes and roles assigned in that project. | ||
| 2. Frontend navigation, route guards, and mutation affordances use `effectiveScopes` for the selected project. | ||
| 3. The server continues to authorize every query and mutation. A hidden control is never an authorization boundary. | ||
| 4. Invitation creation validates that the selected role belongs to the invitation project and that the inviter may grant its scopes. Registration creates membership and role assignment in one transaction. | ||
|
|
||
| ## UI Contract | ||
|
|
||
| | Capability | UI behavior | | ||
| | --- | --- | | ||
| | Read resource | Show route, list, detail values, and static state. | | ||
| | Write resource | Show create, edit, delete, bulk actions, switches, inline editors, and ordering controls. | | ||
| | Read-only Channel/Model/Prompt | Render status as a non-interactive badge. Hide mutation columns and controls. | | ||
| | Project Playground | Query project-profile-approved enabled models only. Disabled or excluded Channels are never listed. | | ||
|
|
||
| The system Channel list remains an audit/configuration view: a system user with `read_channels` can see disabled Channels as static rows. The project model picker is a separate availability view and excludes them at the API boundary. | ||
|
|
||
| ## Delivery Order | ||
|
|
||
| 1. Add effective scopes and correct default project roles. | ||
| 2. Bind invitations to a validated project role. | ||
| 3. Switch frontend permission consumers to effective scopes and align the Playground navigation guard. | ||
| 4. Gate read-only controls in Channel, Model, Prompt, and API Key surfaces. | ||
| 5. Add focused tests for role assignment, effective scopes, invitation registration, and read-only UI behavior. |
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.