@@ -147,10 +147,22 @@ Call `brainkb_login(email, password, base_url?)`. Confirm with `brainkb_whoami()
147147- Add teammates: ` brainkb_add_space_member(slug, email, "editor"|"viewer") ` .
148148
149149### 8. Manage & delegate (RBAC)
150- - ** Admin delegation** (Admin/SuperAdmin only):
151- - Inspect a user: ` brainkb_capabilities(member) ` .
152- - Grant: ` brainkb_grant_capability(member, "create_team_space") ` (or
153- ` manage_team_space ` , ` ingest ` , etc.); revoke with ` brainkb_revoke_capability ` .
150+ - ** See the options first:** ` brainkb_list_capabilities() ` returns the catalog —
151+ all KG capabilities, which are delegatable (` grantable ` ), which are admin-only
152+ (` grant ` , ` sparql_admin ` ), and what each means.
153+ - ** Grant to an INDIVIDUAL** (Admin/SuperAdmin): inspect with
154+ ` brainkb_capabilities(member) ` ; grant with
155+ ` brainkb_grant_capability(member, "create_team_space") ` (or ` ingest ` ,
156+ ` manage_team_space ` , …); revoke with ` brainkb_revoke_capability ` .
157+ - ** Grant to a GROUP/role** (Admin/SuperAdmin): give a capability to * every* member
158+ of a role/group — including a custom group you created:
159+ ` brainkb_grant_role_capability("uk_collaborator", "ingest") ` ;
160+ inspect with ` brainkb_role_capabilities(role) ` ; revoke with
161+ ` brainkb_revoke_role_capability ` . Only ` grantable ` caps may be delegated
162+ (` grant ` /` sparql_admin ` are never delegatable — no escalation).
163+ - ** Custom groups** : create with `brainkb_create_role("uk_collaborator",
164+ "Community", "UK collaborators")` , assign with ` brainkb_assign_role(email,
165+ "uk_collaborator")`, then grant it capabilities (above) and/or per-space access.
154166- ** Fine-grained per-space access rules** (space owner/manager): restrict an action
155167 within a space to a role, a member, or a space-role.
156168 - List: ` brainkb_list_access_rules(slug) ` .
@@ -173,12 +185,23 @@ query_service-only access token won't authorize usermanagement.)
173185- Inspect: ` brainkb_list_users(q, role) ` · ` brainkb_available_roles() ` .
174186- Activate/deactivate an account: ` brainkb_activate_user(email) ` /
175187 ` brainkb_deactivate_user(email) ` .
176- - Assign / remove a role (= permission group: Admin, Lab Member, External, …):
188+ - Assign / remove a role (= permission group: Lab Member, External, custom , …):
177189 ` brainkb_assign_role(email, role) ` / ` brainkb_remove_role(email, role) `
178- (the user must have a profile — i.e. have signed in once).
179- - New group: ` brainkb_create_role("External", "Community", "External collaborators") `
180- then ` brainkb_assign_role(email, "External") ` .
181- - KG-specific capabilities (create team spaces, etc.) are granted with the
190+ (the user must have a profile — i.e. have signed in / registered once).
191+ - New group/category: `brainkb_create_role("uk_collaborator", "Community",
192+ "UK collaborators")` then ` brainkb_assign_role(email, "uk_collaborator")`, then
193+ grant it KG capabilities via §8 (` brainkb_grant_role_capability ` ).
194+ - ** Permissions catalog** : ` brainkb_list_permissions() ` lists usermanagement
195+ permissions (resource/action, used for page-access); add new ones with
196+ ` brainkb_create_permission(name, resource, action, description) ` . (KG action
197+ capabilities are separate — see ` brainkb_list_capabilities ` in §8.)
198+ - ** SuperAdmin > Admin** : assigning/removing the ` Admin ` role, and banning an
199+ Admin, are ** SuperAdmin-only** . The ` SuperAdmin ` role is protected (can't be
200+ removed/banned).
201+ - ** No deletion — ban instead** : accounts are never hard-deleted. Remove access
202+ with ` brainkb_ban_user(email, reason) ` (reversible; preserves history); lift with
203+ ` brainkb_unban_user(email) ` . ` brainkb_deactivate_user ` toggles login access.
204+ - KG-specific capabilities (create team spaces, ingest, etc.) are granted with the
182205 query_service admin tools — see §8.
183206
184207## Typical end-to-end
0 commit comments