Repository navigation
Gate access administration by permission; owner-only grants stay with owners - #321
Merged
Merged
Conversation
… owners Administering access no longer requires holding what is handed out. Whoever holds members.update, projects.manageAccess, project.manageAccess, roles.* or teams.update administers that area, through a system or a custom role. This fixes the Organisation manager, which could not grant Viewer because it holds no project permissions. Three rules remain: - Owner-only permissions (new PermissionDefinition.OwnerOnly: billing, storage, audit, device system tags, device delete, permission ceilings, recording mode and logs, workflow authoring, channels) and the Owner role are granted, edited and handed out through teams by owners only, so delegated administrators hand out at most what the legacy admin tier holds. - project.manageAccess alone still selects resources inside its own scope. - Nobody changes their own access: a role they hold, directly or through a team, or their own team membership (owners excepted). Adds Access.CanManageRole and Access.CanChangeTeamMembers, Role.OwnerOnlyPermission, and GrantDenialSelf; removes GrantDenialPermissionNotHeld and GrantDecision.Project (no consumers yet). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…only Team members: team_member_exceeds_access becomes team_member_owner_only. Role assignments and invitations add *_owner_only; *_exceeds_access now covers resources outside a project.manageAccess caller's scope (and, for invitations, a missing permission). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Second commit (a210b2e), API status contracts:
No consumers use these yet: hub-api has no writers, and the hub-frontend#954 preview is mock-only. Spec: monorepo main f0a6113 (§4.5 rewritten, D11 and the plan decision revised). |
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.
What
Administering access is now gated by permission, not by holding what is handed out. Whoever holds
members.update,projects.manageAccess,project.manageAccess,roles.*orteams.updateadministers that area, through a system role or a custom role.This also fixes a bug on main: the Organisation manager could not grant Viewer (
CanGrant→permissionNotHeld: markers.read), because it holds no project permissions by design.Rules that remain
Owner-only permissions (new
PermissionDefinition.OwnerOnly, also served in the catalog JSON asownerOnly). These are exactly what the legacy admin tier never had:pages.subscription,pages.audit;devices.delete,devices.managePermissions,devices.manageRecording,devices.readLogs(D1, D12);workflows.create/update/delete,workflow-runs.update(D4);channels.*,pages.channels(D5).Only owners grant, create, edit or delete a role holding one, or change the members of a team assigned such a role. Migrated admins therefore grant exactly what they could before, including through a second account. As a consequence, Project admin and Billing admin are granted by owners only.
project.manageAccessalone still selects resources only inside its own scope in the project.Nobody changes their own access:
Owners are exempt; the existing
AffectsUserrule for assignments is unchanged.API
Access.CanGrant/CanChange: no permission bound; owner-only check added.New
Access.CanManageRole(userId, teams, current, next, assignments):roles.create, updateroles.update, deleteroles.delete;ErrRoleInvalid.New
Access.CanChangeTeamMembers(userId, team, teamRoles, members):teams.update;ErrTeamInvalid.Inviting someone into a team goes through this check too.
New
Role.OwnerOnlyPermission()andGrantDenialSelf.Removed
GrantDenialPermissionNotHeldandGrantDecision.Project. No consumers exist yet (hub-api main has noCanGrantcallers).Catalog validation:
Tests
CanManageRoleandCanChangeTeamMemberscases;go vet ./...andgo test ./...pass.The spec (§4.5 and D11) is updated on monorepo main.
🤖 Generated with Claude Code