Skip to content

feat: granular permission assignment for organization members #6231

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

Merged
merged 58 commits into from
Jan 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
de9122d
include organization owner id in Organization type
n1ru4l Dec 30, 2024
905d21a
feat: database migration
n1ru4l Dec 30, 2024
022a527
transform legacy permissions to new format
n1ru4l Dec 30, 2024
05b12ec
rename some things
n1ru4l Dec 30, 2024
edb7fd1
remove export
n1ru4l Dec 30, 2024
b42ae1e
move business logic for hierarchy resolution to the organization memb…
n1ru4l Dec 30, 2024
e3ce5d3
fix import
n1ru4l Dec 30, 2024
1ba564e
expose membership permissions via GraphQL API
n1ru4l Jan 2, 2025
8a046df
feat: permission picker and viewer
n1ru4l Jan 3, 2025
422f62b
fix hints
n1ru4l Jan 3, 2025
ec66b17
db types brr
n1ru4l Jan 3, 2025
0ab8aee
wip
n1ru4l Jan 10, 2025
e82f8c4
move default role definitions to organization-member module
n1ru4l Jan 10, 2025
dc5f41d
this does no longer exist
n1ru4l Jan 13, 2025
e5bc896
minor cleanup
n1ru4l Jan 13, 2025
7e278a5
fix: permission dependencies and decoding
n1ru4l Jan 13, 2025
973224f
integration tests
n1ru4l Jan 13, 2025
76a3fdf
remove member assignment permissions
n1ru4l Jan 13, 2025
4deca5d
clarify permissions
n1ru4l Jan 13, 2025
0586df7
add warning for permissions
n1ru4l Jan 13, 2025
efb3394
show warning for dangerous permissions
n1ru4l Jan 13, 2025
bf78e8d
remove commented out code
n1ru4l Jan 14, 2025
ff9997e
tree structure for resources
n1ru4l Jan 17, 2025
85ccba7
use permissions
n1ru4l Jan 17, 2025
1171e0b
less permissions for viewers
n1ru4l Jan 17, 2025
678b983
dem typings
n1ru4l Jan 17, 2025
572f11a
remove null check
n1ru4l Jan 17, 2025
e8507df
case check
n1ru4l Jan 17, 2025
054f475
merge defs
n1ru4l Jan 17, 2025
f2896eb
dry
n1ru4l Jan 17, 2025
b4e782d
changeset
n1ru4l Jan 17, 2025
ada6846
oops this column does not yet exist
n1ru4l Jan 17, 2025
131326c
jeez
n1ru4l Jan 17, 2025
cafc598
assign role that could do these things
n1ru4l Jan 17, 2025
24d4d05
fix: update role
n1ru4l Jan 20, 2025
1eecb0d
fix: positioning
n1ru4l Jan 20, 2025
22c4edf
remove app deployment describe permission
n1ru4l Jan 20, 2025
bf905a9
move to helpers
n1ru4l Jan 22, 2025
1066f17
simplify amount of user permissions
n1ru4l Jan 22, 2025
bacac9e
member role resource assignments (#6354)
n1ru4l Jan 23, 2025
28e9791
Merge remote-tracking branch 'origin/main' into feat-permission-membe…
n1ru4l Jan 24, 2025
650c1cd
use sheet instead of dialog
n1ru4l Jan 24, 2025
362ad5f
make se;ection more user-friendly
n1ru4l Jan 24, 2025
342cc23
typo
n1ru4l Jan 24, 2025
c0b78c5
sanatize input
n1ru4l Jan 24, 2025
cb29617
batch
n1ru4l Jan 24, 2025
1ccfadf
Merge remote-tracking branch 'origin/main' into feat-permission-membe…
n1ru4l Jan 27, 2025
df6d708
fix
n1ru4l Jan 27, 2025
912947c
lint
n1ru4l Jan 27, 2025
af6f7c4
fix permission inheritance
n1ru4l Jan 27, 2025
6d7acf7
unit test for resource assignment group translation
n1ru4l Jan 28, 2025
4c2215e
Merge remote-tracking branch 'origin/main' into feat-permission-membe…
n1ru4l Jan 28, 2025
0ac6d0e
overflow-auto
n1ru4l Jan 28, 2025
f182dd8
no tooltip delay
n1ru4l Jan 28, 2025
d2a31c5
focus ring scurr
n1ru4l Jan 28, 2025
d219e5b
typo
n1ru4l Jan 28, 2025
d679387
ai bro
n1ru4l Jan 28, 2025
d06ba59
access
n1ru4l Jan 28, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .changeset/tall-islands-occur.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
'hive': major
---

Introduce new permission system for organization member roles.

The existing scopes assigned to organization member users are now replaced with permissions.
Using the permissions allows more granular access control to features in Hive.

This introduces the following breaking changes:

- Organization members with the default `Viewer` role, will experience downgraded permissions. They will no longer be able to create targets or projects.
- Organization member roles permissions for inviting, removing or assigning roles have been revoked. A organization admin will have to re-apply the permissions to the desired member roles.
- Organization members with permissions for managing invites, removing members, assigning roles or modifying roles are no longer restrained in granting more rights to other users. Please be aware when granting these permissions to a user role. We recommend only assigning these to member roles that are considered "Admin" user roles.

A future update will introduce resource based access control (based on project, target, service or app deployments) for organization members.
31 changes: 13 additions & 18 deletions integration-tests/testkit/flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ export function createOrganization(input: CreateOrganizationInput, authToken: st
slug
owner {
id
organizationAccessScopes
projectAccessScopes
targetAccessScopes
role {
id
permissions
}
}
memberRoles {
id
Expand Down Expand Up @@ -178,9 +179,11 @@ export function joinOrganization(code: string, authToken: string) {
user {
id
}
organizationAccessScopes
projectAccessScopes
targetAccessScopes
role {
id
name
permissions
}
}
}
}
Expand Down Expand Up @@ -213,10 +216,8 @@ export function getOrganizationMembers(selector: OrganizationSelectorInput, auth
role {
id
name
permissions
}
organizationAccessScopes
projectAccessScopes
targetAccessScopes
}
}
}
Expand Down Expand Up @@ -664,9 +665,7 @@ export function createMemberRole(input: CreateMemberRoleInput, authToken: string
name
description
locked
organizationAccessScopes
projectAccessScopes
targetAccessScopes
permissions
}
}
}
Expand Down Expand Up @@ -724,9 +723,7 @@ export function deleteMemberRole(input: DeleteMemberRoleInput, authToken: string
name
description
locked
organizationAccessScopes
projectAccessScopes
targetAccessScopes
permissions
}
}
}
Expand Down Expand Up @@ -754,9 +751,7 @@ export function updateMemberRole(input: UpdateMemberRoleInput, authToken: string
name
description
locked
organizationAccessScopes
projectAccessScopes
targetAccessScopes
permissions
}
}
error {
Expand Down
30 changes: 12 additions & 18 deletions integration-tests/testkit/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import {
updateMemberRole,
updateTargetValidationSettings,
} from './flow';
import * as GraphQLSchema from './gql/graphql';
import {
BreakingChangeFormula,
OrganizationAccessScope,
Expand Down Expand Up @@ -185,10 +186,10 @@ export function initSeed() {

return members;
},
async projects() {
async projects(token = ownerToken) {
const projectsResult = await getOrganizationProjects(
{ organizationSlug: organization.slug },
ownerToken,
token,
).then(r => r.expectNoGraphQLErrors());

const projects = projectsResult.organization?.organization.projects.nodes;
Expand Down Expand Up @@ -806,6 +807,7 @@ export function initSeed() {
input: {
roleId: string;
userId: string;
resources?: GraphQLSchema.ResourceAssignmentInput;
},
options: { useMemberToken?: boolean } = {
useMemberToken: false,
Expand All @@ -816,6 +818,10 @@ export function initSeed() {
organizationSlug: organization.slug,
userId: input.userId,
roleId: input.roleId,
resources: input.resources ?? {
mode: GraphQLSchema.ResourceAssignmentMode.All,
projects: [],
},
},
options.useMemberToken ? memberToken : ownerToken,
).then(r => r.expectNoGraphQLErrors());
Expand Down Expand Up @@ -847,11 +853,7 @@ export function initSeed() {
return memberRoleDeletionResult.deleteMemberRole.ok?.updatedOrganization;
},
async createMemberRole(
scopes: {
organization: OrganizationAccessScope[];
project: ProjectAccessScope[];
target: TargetAccessScope[];
},
permissions: Array<string>,
options: { useMemberToken?: boolean } = {
useMemberToken: false,
},
Expand All @@ -867,9 +869,7 @@ export function initSeed() {
organizationSlug: organization.slug,
name,
description: 'some description',
organizationAccessScopes: scopes.organization,
projectAccessScopes: scopes.project,
targetAccessScopes: scopes.target,
selectedPermissions: permissions,
},
options.useMemberToken ? memberToken : ownerToken,
).then(r => r.expectNoGraphQLErrors());
Expand Down Expand Up @@ -908,11 +908,7 @@ export function initSeed() {
name: string;
description: string;
},
scopes: {
organization: OrganizationAccessScope[];
project: ProjectAccessScope[];
target: TargetAccessScope[];
},
permissions: Array<string>,
options: { useMemberToken?: boolean } = {
useMemberToken: false,
},
Expand All @@ -923,9 +919,7 @@ export function initSeed() {
roleId: role.id,
name: role.name,
description: role.description,
organizationAccessScopes: scopes.organization,
projectAccessScopes: scopes.project,
targetAccessScopes: scopes.target,
selectedPermissions: permissions,
},
options.useMemberToken ? memberToken : ownerToken,
).then(r => r.expectNoGraphQLErrors());
Expand Down
Loading
Loading