Commit Graph
9 Commits
Author SHA1 Message Date
Jeremy Ruppel 2d65ff14c3 fix(coderd): sort built-in and custom roles for stable list order (#32463)
The role selector on the new user page showed roles in a different order
on every load. `SiteBuiltInRoles()` and `OrganizationRoles()` built
their lists by ranging over the `builtInRoles` map, so `GET
/api/v2/users/roles` and `GET /api/v2/organizations/{org}/members/roles`
returned built-in roles in random order.

Both functions now sort roles by name before returning. The
`CustomRoles` query also had no `ORDER BY`, so custom roles, which are
appended after the built-in ones, now come back ordered by `name,
organization_id`.

`TestListRoles` and `TestReadCustomRoles` now assert the exact order.
Each fails without its fix and passes with it.

Closes CLIENT-1104

---

*Generated by Coder Agents on behalf of @jeremyruppel.*
2026-12-01 09:31:21 -05:00
George K cc2efe9e1f feat(coderd/rbac): make organization-member a per-org system custom role (#21359)
Migrated the built-in organization-member role to DB storage so it can be customized per org.

Closes https://github.com/coder/internal/issues/1073 (part 1)
2026-01-12 18:19:19 -08:00
ケイラ 91a4a98c27 chore: add an unassign action for roles (#16728) 2025-02-27 10:39:06 -07:00
Steven MasleyandJaayden Halko 84fdfd2a18 chore: remove UpsertCustomRole in favor of Insert + Update (#14217)
* chore: remove UpsertCustomRole in favor of Insert + Update

---------

Co-authored-by: Jaayden Halko <jaayden.halko@gmail.com>
2024-08-13 12:53:47 -05:00
Steven Masley 2c13797350 chore: implement deleting custom roles (#14101)
* chore: implement deleting custom roles

* add trigger to delete role from organization members on delete
* chore: add comments to explain populated field
2024-08-07 12:37:55 -05:00
Steven Masley e2b330fcba chore: change sql parameter for custom roles to be a (name,org_id) tuple (#13480)
* chore: sql parameter to custom roles to be a (name,org) tuple

CustomRole lookup takes (name,org_id) tuples as the search criteria.
2024-06-06 15:36:37 -05:00
Steven Masley 1b4ca00428 chore: include custom roles in list org roles (#13336)
* chore: include custom roles in list org roles
* move cli show roles to org scope
2024-05-23 07:54:59 -10:00
Steven Masley c61b64be61 feat: add hidden enterprise cmd command to list roles (#13303)
* feat: add hidden enterprise cmd command to list roles

This includes custom roles, and has a json ouput option for
more granular permissions
2024-05-21 13:14:00 -05:00
Steven Masley cf91eff7cf chore: implement databased backend for custom roles (#13295)
Includes db schema and dbauthz layer for upserting custom roles. Unit test in `customroles_test.go` verify against escalating permissions through this feature.
2024-05-16 13:11:26 -05:00