Skip to main content

Assign roles in a project

Say who may see, operate, approve and administer the tickets of a project, with a pull request.

Prerequisites​

  • A running afe serve with single sign-on, so people arrive with groups.
  • The names of the groups in your identity provider.
  • For automation, a service account of afe.

Steps​

  1. Add an access block to the Project manifest. Each role takes a list of subjects:

    apiVersion: afe.dev/v1alpha1
    kind: Project
    metadata:
    name: acme
    spec:
    workspace:
    type: folder
    path: /srv/acme
    access:
    viewer: [group:acme-readers]
    operator: [group:acme-devs, afeServiceAccount:jira-trigger]
    approver: [group:acme-leads]
    administrator: [group:acme-admins]

    A subject is group:<name> for a group of the identity provider. It is afeServiceAccount:<name> for a service account of afe, by name.

  2. Optional: limit a grant to some flows when a role should not reach the whole project. Write the entry as an object with subject and flows:

    access:
    approver:
    - group:acme-leads
    - subject: group:acme-support
    flows: [refund, triage]

    A limited grant only narrows. It keeps the rights of the role, and only on those flows, in every list, read and command. Two grants of one subject add up. An unknown flow fails validation.

  3. Check the manifests:

    afe validate -c config/
  4. Merge the change and apply the new configuration. A role change is a configuration revision.

  5. Read the change in the audit trail:

    afe audit --action project.access --project acme

    The entry lists the grants added and removed for each role. A limited grant shows its flows in brackets. An administrator limited to some flows reads the audit entries of those flows only.

note

afeServiceAccount names a service account of afe, the ones you create with afe service-account create. It is not a Kubernetes ServiceAccount. No token enters the manifest.

What each role does​

  • viewer sees the project's tickets, events, artifacts and BPMN.
  • operator sees, and starts, reruns, pauses, cancels and resumes tickets.
  • approver sees, and answers questions: human nodes, budget, loop guard and hand-over.
  • administrator does everything above, and reads the project's audit trail.

A caller holds the union of the roles its groups and its name reach. The full matrix is in the Project reference.

Troubleshooting​

A person sees no tickets. None of their groups is in the project's access. A project without access is reachable only by global administrators.

permission denied (-32008). The caller sees the ticket but lacks the right. An operator cannot answer a question. An approver cannot cancel.

A ticket is "not found". The caller has no role in the ticket's project. The engine answers the same for a ticket that does not exist.

A project without workspace refuses a flow. It serves only flows with requiresWorkspace: none.

See also​