Thanks to visit codestin.com
Credit goes to github.com

Skip to content

feat(site): add Default Roles section to organization roles page - #26028

Merged
Emyrk merged 3 commits into
mainfrom
gateway-accounts/default-roles-ui
Jun 5, 2026
Merged

feat(site): add Default Roles section to organization roles page#26028
Emyrk merged 3 commits into
mainfrom
gateway-accounts/default-roles-ui

Conversation

@Emyrk

@Emyrk Emyrk commented Jun 3, 2026

Copy link
Copy Markdown
Member

Refs #25936. Stacks on #26027.

Adds a Default Roles section to the org Roles page that edits an org's default_org_member_roles via the existing PATCH endpoint.

  • Lives at the top of the org Roles page (above Custom Roles), sharing the same organizationRoles query used by the rest of the page.
  • Gated on the minimum-implicit-member experiment via useDashboard().experiments and on the org editSettings permission.
  • Uses the existing RoleSelector primitive inside a new DefaultRolesDialog.
  • Empty selection is supported and explicitly called out in the dialog copy.
  • Toasts on success, surfaces getErrorDetail on failure.
  • Storybook coverage for hidden, enabled, empty, no-edit-permission, and dialog-open states.

Setting is in Roles section

Screenshot From 2026-06-05 12-20-20

Without license

Screenshot From 2026-06-05 12-20-56

Video before setting was moved

Example of a regular member making a workspace. Then the org default roles being changed to remove the "workspace-access". The member can no longer view or create a workspace.

Screencast.From.2026-06-03.18-02-06.webm
Implementation notes
  • RoleSelectorDialog is the existing per-user role editor; it's user-centric (avatar header, username/email props). Wrapping it for the org-default case would have meant feeding it a synthetic "user", so this PR adds a small sibling DefaultRolesDialog and reuses the inner RoleSelector primitive directly. Same look, same behavior in the picker.
  • The PATCH already exists from feat: configurable default org member roles #25994 (updateOrganization -> default_org_member_roles). The Roles page now owns the updateOrganization mutation used by the section.
  • organizationRoles(orgName) is already fetched by the Roles page; the Default Roles section reuses that query rather than firing a parallel one.
  • DefaultRolesSummary resolves role names to display names via the fetched AssignableRoles[], falling back to the raw name when the role is not in the list.

Coder Agents on behalf of @Emyrk.

@Emyrk
Emyrk force-pushed the gateway-accounts/default-roles-ui branch 2 times, most recently from c4a5fcc to 976957f Compare June 3, 2026 19:17
@Emyrk
Emyrk force-pushed the gateway-accounts/floor-shrink-org-member branch from c91e381 to d1ee7c9 Compare June 3, 2026 20:48
@Emyrk
Emyrk force-pushed the gateway-accounts/default-roles-ui branch from 976957f to 8ea2020 Compare June 3, 2026 20:48
@Emyrk
Emyrk force-pushed the gateway-accounts/floor-shrink-org-member branch from d1ee7c9 to 7813b1a Compare June 3, 2026 21:09
@Emyrk
Emyrk force-pushed the gateway-accounts/default-roles-ui branch 2 times, most recently from 5c9c069 to 620c357 Compare June 3, 2026 21:23
@Emyrk
Emyrk force-pushed the gateway-accounts/floor-shrink-org-member branch 2 times, most recently from 210be86 to 34ec9ef Compare June 3, 2026 21:43
@Emyrk
Emyrk force-pushed the gateway-accounts/default-roles-ui branch 2 times, most recently from eb10210 to 538597d Compare June 3, 2026 21:56
@Emyrk
Emyrk force-pushed the gateway-accounts/floor-shrink-org-member branch 2 times, most recently from 8e1cf4c to d46be0c Compare June 3, 2026 22:14
@Emyrk
Emyrk force-pushed the gateway-accounts/default-roles-ui branch from 538597d to 986699a Compare June 3, 2026 22:14
@Emyrk
Emyrk force-pushed the gateway-accounts/floor-shrink-org-member branch from d46be0c to 0e1c45b Compare June 3, 2026 22:20
@Emyrk
Emyrk force-pushed the gateway-accounts/default-roles-ui branch from 986699a to 8a07ffd Compare June 3, 2026 22:20
@Emyrk
Emyrk force-pushed the gateway-accounts/floor-shrink-org-member branch from 0e1c45b to b78d140 Compare June 3, 2026 22:29
@Emyrk
Emyrk force-pushed the gateway-accounts/default-roles-ui branch from 8a07ffd to 9884564 Compare June 3, 2026 22:29
@Emyrk
Emyrk marked this pull request as ready for review June 3, 2026 23:03
@Emyrk
Emyrk requested a review from geokat June 4, 2026 17:14
@Emyrk
Emyrk force-pushed the gateway-accounts/floor-shrink-org-member branch from b78d140 to 900ff1c Compare June 5, 2026 14:19
@Emyrk
Emyrk force-pushed the gateway-accounts/default-roles-ui branch from 9884564 to 3d4e175 Compare June 5, 2026 14:19
@Emyrk
Emyrk force-pushed the gateway-accounts/floor-shrink-org-member branch from 900ff1c to 9154d41 Compare June 5, 2026 15:32
@Emyrk
Emyrk force-pushed the gateway-accounts/default-roles-ui branch from 3d4e175 to bf9be56 Compare June 5, 2026 15:32
@Emyrk
Emyrk requested review from DanielleMaywood and removed request for DanielleMaywood June 5, 2026 16:53
@Emyrk Emyrk changed the title feat(site): add Default Roles section to organization settings feat(site): add Default Roles section to organization roles page Jun 5, 2026
Comment on lines +105 to +118
onUpdateDefaultRoles={async (roles) => {
try {
await updateOrganizationMutation.mutateAsync({
organizationId: organization.id,
req: { default_org_member_roles: roles },
});
toast.success("Default roles updated.");
} catch (error) {
toast.error(
getErrorMessage(error, "Failed to update default roles."),
{ description: getErrorDetail(error) },
);
}
}}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small nit and unsure of other frontend peep's opinions on this, but I think I'd prefer to have this try/catch logic moved out of the markup (or removed entirely).

I think we should either:

  • Update the existing useMutation to define onSuccess and onError handlers (although making sure to not overwrite the original onSuccess and onError definitions).
  • Make use of mutate's onSuccess and onError call arguments to achieve this.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see it was just copying the pattern below for DeleteDialog.
I am going to leave this pattern right here so this CustomRolesPage is consistent with itself. Any fix should do both

Comment thread site/src/pages/OrganizationSettingsPage/CustomRolesPage/CustomRolesPageView.tsx Outdated
@Emyrk
Emyrk force-pushed the gateway-accounts/floor-shrink-org-member branch from 9154d41 to fb90875 Compare June 5, 2026 18:59
@Emyrk
Emyrk force-pushed the gateway-accounts/default-roles-ui branch from 9fa32a5 to a67d838 Compare June 5, 2026 18:59
@Emyrk
Emyrk force-pushed the gateway-accounts/floor-shrink-org-member branch from fb90875 to d265c34 Compare June 5, 2026 19:20
@Emyrk
Emyrk force-pushed the gateway-accounts/default-roles-ui branch from a67d838 to 238f18b Compare June 5, 2026 19:20
@Emyrk
Emyrk force-pushed the gateway-accounts/floor-shrink-org-member branch from d265c34 to 4c0ab67 Compare June 5, 2026 19:34
@Emyrk
Emyrk force-pushed the gateway-accounts/default-roles-ui branch from 238f18b to 8a535b1 Compare June 5, 2026 19:34
@Emyrk
Emyrk force-pushed the gateway-accounts/floor-shrink-org-member branch 2 times, most recently from bb1bdc0 to 5c49c19 Compare June 5, 2026 20:02
@Emyrk
Emyrk force-pushed the gateway-accounts/default-roles-ui branch from 8a535b1 to 56220d5 Compare June 5, 2026 20:02
@Emyrk
Emyrk changed the base branch from gateway-accounts/floor-shrink-org-member to graphite-base/26028 June 5, 2026 20:31
Emyrk added 2 commits June 5, 2026 20:31
Adds a new Default Roles section to the org settings page (gated on
the minimum-implicit-member experiment) that edits an org's
default_org_member_roles via the existing PATCH endpoint.

Uses the existing RoleSelector primitive via a new
DefaultRolesDialog sibling. RoleSelectorDialog itself is too
user-centric (avatar header, username/email props) to reuse here.

Refs #25936.
Relocate the Default Roles section, its dialog, and the roles query
to the organization Roles page. The selector sits above Custom Roles,
shares the page-level roles query, and stays gated on the experiment
plus the editSettings permission.
@Emyrk
Emyrk force-pushed the gateway-accounts/default-roles-ui branch from 56220d5 to 206014f Compare June 5, 2026 20:31
@Emyrk
Emyrk force-pushed the graphite-base/26028 branch from 5c49c19 to f17f839 Compare June 5, 2026 20:31
@graphite-app
graphite-app Bot changed the base branch from graphite-base/26028 to main June 5, 2026 20:32
The comments either named an experiment that will go stale when
`minimum-implicit-member` is promoted, or described implementation
rather than behavior. Prop names already convey intent.
@Emyrk
Emyrk force-pushed the gateway-accounts/default-roles-ui branch from 206014f to 3a0ec37 Compare June 5, 2026 20:32
@Emyrk
Emyrk merged commit 4124d5b into main Jun 5, 2026
24 of 26 checks passed
@Emyrk
Emyrk deleted the gateway-accounts/default-roles-ui branch June 5, 2026 22:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants