Skip to content

The authorization reef

Every command of the first slice: Users, teams, roles and bindings, and who may do what.

Commands

Examples

reef-apply

The kinds of the reef.

nereus reef apply authorization
output
✓ core/reefs/authorization created (authorization.getnereus.dev/v1alpha1: bindings, roles)

Next steps:

  nereus nereid apply openfga --reef authorization

nereid-apply

The profile installs the Nereid and its default Mandate (an excerpt).

nereus profile apply internal-developer-platform
output
✓ networkpolicy openfga                      0.0s  networkpolicies/openfga applied (only nereus-api and vmagent-nereus reach openfga)
✓ nereid openfga                            1m19s  core/nereids/openfga created, Ready
✓ mandate openfga                            7.0s  core/mandates/openfga created (reef: authorization, nereid: openfga, default)

user-create

The tech lead.

nereus user create ana \
  --email ana@example.com
output
✓ core/users/ana created

user-list

The people of this instance.

nereus user list
output
NAME   EMAIL              IDENTITIES  AGE
ana    ana@example.com    1           2m
bruno  bruno@example.com  0           1m

role-list

The roles of this instance.

nereus authorization role list
output
NAME           RULES                    BUILT IN
administrator  *:*:*                    yes
developer      *:*:list,get and 3 more  -
team-lead      *:*:list,get and 5 more  -
viewer         *:*:list,get             -

role-get

What a team lead may do.

nereus authorization role get team-lead
output
team-lead: 6 rules
REEF         KINDS         VERBS
*            *             list,get
build        builds        create,apply,delete
delivery     deliveries    create,apply,delete
environment  environments  create,delete
release      releases      create,apply,delete
teams        members       create,delete

role-create

A role of this instance's own.

nereus authorization role create release-manager \
  --rule release:releases:create,apply,delete
output
✓ authorization/roles/release-manager created

Next steps:

  nereus authorization binding create <name> --role release-manager --team <team> --owner project/<project>

role-delete

No one locks the instance out.

nereus authorization role delete administrator
output
✗ authorization/roles/administrator is built in: it cannot be changed or deleted. To see who holds it, run:
  nereus authorization binding list --role administrator
  Nothing was changed.

binding-team

Everyone in the team is a developer of the Project.

nereus authorization binding create payments-developers \
  --role developer \
  --team payments \
  --owner project/payments
output
✓ authorization/bindings/payments-developers created

Next steps:

  nereus authorization binding list --owner project/payments

binding-position

Only who holds the position.

nereus authorization binding create payments-leads \
  --role team-lead \
  --team payments \
  --position tech-lead \
  --owner project/payments
output
✓ authorization/bindings/payments-leads created

Next steps:

  nereus authorization binding list --owner project/payments

binding-list

Who may do what on the Project.

nereus authorization binding list \
  --owner project/payments
output
NAME                 SUBJECT                  ROLE       OWNER
payments-developers  team/payments            developer  project/payments
payments-leads       team/payments/tech-lead  team-lead  project/payments

can-i-yes

Signed in as ana: with no --user, the question is about the caller.

nereus authorization can-i create environment/environments \
  --owner project/payments
output
yes: authorization/bindings/payments-leads gives team-lead to team/payments/tech-lead at project/payments

can-i-no

About someone else.

nereus authorization can-i create environment/environments \
  --owner project/payments \
  --user bruno
output
no: no binding gives bruno create on environment/environments at project/payments

Next steps:

  nereus authorization binding list --owner project/payments

can-i-shortcut

Signed in as bruno: a developer creates builds.

nereus can-i create build/builds \
  --owner project/payments
output
yes: authorization/bindings/payments-developers gives developer to team/payments at project/payments

can-i-drive

Ana is a speaker of platform-day.

nereus authorization can-i drive presentations/sessions/platform-day \
  --user ana
output
yes: ana is a speaker of platform-day

can-i-assist

Carla is on the staff team of platform-day.

nereus authorization can-i assist presentations/sessions/platform-day \
  --user carla
output
yes: carla is on the staff of platform-day (team stage-2-staff)

enforce-denied

Signed in as bruno.

nereus environment create staging \
  --owner project/payments
output
✗ environment/environments/staging: bruno may not create environment/environments at project/payments. To see who may, run:
  nereus authorization binding list --owner project/payments
  Nothing was changed.

enforce-allowed

Signed in as ana, the tech lead.

nereus environment create staging \
  --owner project/payments
output
✓ environment/environments/staging created (mandate: vcluster, nereid: vcluster)

Next steps:

  nereus environment get staging --watch

leave-team

Ana leaves the team.

nereus teams member delete ana \
  --team payments
output
✓ teams/teams/payments/members/ana deleted

fail-closed

A read while the Nereid does not answer.

nereus environment list
output
✗ authorization does not answer (nereid: openfga): nothing is allowed until it is back. To see what is down, run:
  nereus doctor
  Nothing was changed.