The owner may set the owner role's colour (GRYT-906, GRYT-907) - #133
Merged
Conversation
Two changes to the role editor's server half. **The owner role's colour saves.** `server:roles:definitions:save` refused every edit to it outright. The reason holds for name, rank and permissions — `services/permissions` falls back to the owner role when a lookup fails, and it is the only thing between a mistake in that editor and a server nobody can administer. A colour is not part of that. It grants nothing, moves nobody, and locks nobody out. So a colour-only exception, and the shape of it is deliberately narrow: - Every other field must be absent, not merely ignored. A payload carrying a rank or a permission beside the colour is refused whole rather than half-applied. - Everything written back comes from the row as it stands, so there is no path through here that changes anything but the colour. - It sits before the two rank checks, because it has to: the owner role's rank is the owner's own, so `existing.rank >= auth.rank` refuses the owner editing their own role. - Which is why it carries its own gate. `manage_roles` alone would let a delegated admin recolour the owner so the owner reads as an ordinary member. Rank is the check the rest of the file uses for "you are not above this". `ownerRoleColour.test.ts` is 19 cases and most of them are about the hole being no wider than intended. **`roleEditorState` sends `identityTiers`.** The editor offers a guest default role with a footnote underneath explaining the setting may never be used, because it had no way to tell. `getAcceptedIdentityTiers()` already exists and is already on `/api/server-info`; this puts it on the payload the tab reads, so the client can turn the control off and say why instead. The client half is GRYT-907. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Two changes to the role editor's server half. The client halves are client#386 (opened alongside this).
The owner role's colour saves
server:roles:definitions:saverefused every edit to the owner role:The reason holds for name, rank and permissions —
services/permissionsfalls back to the owner role when a lookup fails, and it is the only thing between a mistake in that editor and a server nobody can administer. A colour is not part of that: it grants nothing, moves nobody, and locks nobody out. Refusing it was the blanket rule catching something it was not written for.The exception is deliberately narrow:
existing.rank >= auth.rankrefuses the owner editing their own role.What to look at
manage_rolesalone would let a delegated admin recolour the owner role so the owner reads as an ordinary member. Small, but social engineering for no benefit, so this also requiresauth.rank >= existing.rank— in practice, the owner. If you would rather anymanage_rolesholder could do it, delete that block; the test names the case.!savedbranch.updateRoleDefinitionreturns null if the row went between the read and the write. Emittingserver:roles:definition:updatedthere would have clients drawing a colour the server does not hold.roleEditorStatesendsidentityTiersThe editor offers an "As a guest" default role with a footnote underneath explaining the setting may never be used, because it had no way to tell.
getAcceptedIdentityTiers()already exists and is already on/api/server-info; this puts it on the payload the tab already reads, so the client can disable the control and say why. Read-only, admin-only — it goes to a handler already gated onmanage_roles.Verification
yarn test(713 tests),yarn buildandnpx eslint .all pass; the two eslint warnings are pre-existing and in files this does not touch.ownerRoleColour.test.tsis new — 19 cases, and most of them are about the hole being no wider than intended. Mutation-tested, all four caught:🤖 Generated with Claude Code