Skip to content
PlatformMarkdown

Delegated administration

Make a group the administrators of a realm and every realm beneath it, or let it only look, with reach that descends and never climbs.

Available, with limitsAPI

Delegated administration decides who may read, change or hand on a realm’s configuration. You give that right to a group, and its members administer your realm and the realms beneath it, and nothing else. It is how you hand a team its own realm: a business unit, a partner or a customer of yours runs it, while you keep oversight from above.

Administration is its own plane, separate from the policies that protect your apps. It answers one question: may this user read, change or delegate this realm’s configuration?

  • Privilege: DELEGATE on the realm’s delegation configuration, which RealmOwner gives. You can grant only what you hold yourself.
  • Where: the API, at https://foobar.cvyuh.com/api/v0/am/privilege/v1.
  • First: the group you’ll grant to must exist in the realm: see Add groups and members. Your session is in $CVYUH_SESSION (Call the API).

A privilege bundles permission templates. A template names part of a realm’s configuration, where *REALM stands for the realm the privilege is held in, and the actions it allows: READ, MODIFY and DELEGATE. Every realm holds two privileges from the start:

PrivilegeTemplateActionsGives
RealmOwner*REALM/*READ, MODIFY, DELEGATEFull administration, including granting it to others
RealmViewer*REALM/*READEvery setting and object to read, and no change

A privilege is held by groups, never by a user directly. To make someone an administrator, put them in a group and grant the group the privilege. A privilege may instead be held by every signed-in user of the realm (allAuthenticated).

Reach descends. A group holding RealmOwner in foobar administers foobar and engineering beneath it; one holding it in engineering can’t reach foobar. Nothing is copied into a realm beneath, so a grant made today reaches realms created tomorrow.

Grant a privilege to one of the realm’s groups, naming the privilege every time. Here the finance group may read everything in foobar and change nothing:

Terminal window
curl https://foobar.cvyuh.com/api/v0/am/privilege/v1 \
-H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
-H "Content-Type: application/json" \
-d '{ "group": "finance", "privilege": "RealmViewer" }'

The realm answers 201, naming the group and the privilege. To grant in a realm beneath yours, make the same call on that realm’s host name, to one of its own groups.

List each privilege and the groups that hold it:

Terminal window
curl https://foobar.cvyuh.com/api/v0/am/privilege/v1 \
-H "Cookie: x-cvyuh-token=$CVYUH_SESSION"
{ "privileges": [
{ "name": "RealmOwner", "groups": ["foobar_admins"], "allAuthenticated": false },
{ "name": "RealmViewer", "groups": ["finance"], "allAuthenticated": false } ] }

Take one back, naming the privilege here too: left out, it means RealmOwner. The realm answers 200.

Terminal window
curl -X DELETE "https://foobar.cvyuh.com/api/v0/am/privilege/v1/finance?privilege=RealmViewer" \
-H "Cookie: x-cvyuh-token=$CVYUH_SESSION"

When RealmOwner gives too much and RealmViewer too little, write a privilege of your own. Templates live at https://foobar.cvyuh.com/api/v0/am/objects/v1/delegationPermission, privileges at https://foobar.cvyuh.com/api/v0/am/objects/v1/delegationPrivilege. Reading them needs READ on the realm’s delegation configuration, and writing them MODIFY.

A template’s resource names what it covers. Objects you change through /api/v0/am/objects/v1/<type> are *REALM/entity/<type>/*: the type, and every object of it. * matches anything, / included, so *REALM/* is everything.

Here, a privilege that lets the engineering group run sign-in for foobar (its sign-in settings and chains) and nothing else:

  1. Write a template for each type it covers.

    Terminal window
    curl "https://foobar.cvyuh.com/api/v0/am/objects/v1/delegationPermission?id=signInSettings" \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
    -H "Content-Type: application/json" \
    -d '{ "resource": "*REALM/entity/authSettings/*", "actions": ["READ", "MODIFY"] }'
    curl "https://foobar.cvyuh.com/api/v0/am/objects/v1/delegationPermission?id=signInChains" \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
    -H "Content-Type: application/json" \
    -d '{ "resource": "*REALM/entity/authChain/*", "actions": ["READ", "MODIFY"] }'
  2. Write the privilege, and link the templates to it.

    Terminal window
    curl "https://foobar.cvyuh.com/api/v0/am/objects/v1/delegationPrivilege?id=SignInAdmin" \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
    -H "Content-Type: application/json" \
    -d '{ "allAuthenticated": false }'
    curl https://foobar.cvyuh.com/api/v0/am/objects/v1/delegationPrivilege/SignInAdmin/relationships/permissions \
    -H "Cookie: x-cvyuh-token=$CVYUH_SESSION" \
    -H "Content-Type: application/json" \
    -H "If-Match: *" \
    -d '{ "targetId": "signInSettings" }'

    Link signInChains the same way.

  3. Grant it through privilege/v1, as above: { "group": "engineering", "privilege": "SignInAdmin" }. Who holds a privilege is only ever written there.

AnswerCauseWhat to do
403, “not permitted on …”Your rights don’t cover the change; the message names what was refusedAsk for a privilege that covers it, in this realm or one above
403 on a grantYou’d grant something you don’t hold yourself, or you’re granting in a realm beside yoursGrant only what you hold, from a realm above the target
404 on a grantNo such group, or no such privilege, in this realmCreate the group first; check the privilege’s name
404 on a take-backThe group doesn’t hold that privilegeName the privilege it holds

An administrator whose privilege is taken back keeps their session, and is refused their next change.

WhatDefaultCan it change
Privileges every realm starts withRealmOwner, RealmViewerAdd your own; the two stay
privilege left out of a grant or take-backRealmOwnerNo: always name it
Templates that reach realms beneathOnly *REALM/*No
Who holds a privilegeGroups, or every signed-in user (allAuthenticated)Never a user directly
  • A role of your own works here but not in a realm beneath. Only *REALM/* descends. A narrower template, like *REALM/entity/authSettings/*, applies only in the realm that holds the privilege. Hold the privilege in each realm where it should apply.
  • A user in the group is still refused. Rights are checked on every request, so check the user really is a member, with GET https://foobar.cvyuh.com/api/v0/am/objects/v1/user/<user>?expand=memberOf, and that they signed in to this realm or one above it, not to a realm beside it.
  • Everyone can read the configuration. A privilege has allAuthenticated set. List the privileges, and set it to false on any that shouldn’t reach every user.

A grant or take-back is a change to the privilege: an UPDATED record naming who made it and the link added or removed. Read it as the privilege’s change history, such as GET https://foobar.cvyuh.com/api/v0/am/objects/v1/delegationPrivilege/RealmOwner/history. Templates and privileges of your own have their history at their own addresses the same way. A refused admin call changes nothing, and isn’t on the audit trail.

  • Where you stand is the realm you signed in to. Nothing in a request moves it. You may call another realm on its host name; whether you may act there is decided from where you stand.
  • Beneath means beneath. A realm named sales-2 beside sales is not beneath it, and sales’s administrators don’t reach it.
  • RealmViewer reads everything and is refused every change.
  • No second check for sensitive changes. A session that holds RealmOwner can make any change for as long as it lasts; no admin change asks for a fresh sign-in. Keep administrators’ sessions short with the realm’s Sessions settings.