Permissions

Rename or re-describe a role

Rename / re-describe a role, deliberately and audited.

Renaming a system TEMPLATE cascades to every company copy of it, in one statement (owner decision, 2026-08-27). Template and copies are name-identical by construction — ensure_company_role_copies copies t.name and nothing renames a copy — so letting them diverge would make the list HARDER to read, which is the problem this work exists to fix.

Three guards, in order:

  1. A no-op writes nothing. The frontend always sends both fields (setRoleForm({name: role.name || '', description: role.description || ''})), so "unset means unchanged" is not available — the diff is computed here against the stored row. Without it, opening a template and pressing Guardar would rewrite 19 rows across 18 tenants and file 19 audit rows; and the || '' would write '' over every NULL description.
  2. A system row needs edit_system_role. The refusal names the token because useRolesPermissions.js::isPrivilegedGrantRefusal distinguishes retryable refusals by detail text, not by status code.
  3. A system COPY may not be renamed at all. Its name belongs to the template. Allowing it manufactures exactly the divergence the cascade prevents, and there is no way back — reset-template only rewrites modulo.* rows. The description stays editable.
put/api/roles/{role_id}

Request

  • Base URL
    https://api.multigest.pt (the document declares no server; this is the origin it was published from)
  • URL
    https://api.multigest.pt/api/roles/{role_id}
  • Auth
    API key in header x-api-token and API key in header x-origin-verify

Path parameters

role_idinteger required

Headers

x-api-tokenstring nullable

Request body

namestring nullable
descriptionstring nullable
edit_system_roleboolean

Response

Successful Response

unknown required

Changes

No recorded changes to this operation across all 21 revisions of this API.