Roles
Use roles to grant employees (authenticated users) permissions. That is preferable to granting permissions to individuals.
What are good roles?
Section titled “What are good roles?”Define roles around areas of responsibility rather than job titles. For example, if office staff also purchase office equipment, create separate Office staff and Purchasing roles. Assign both roles to employees who handle both responsibilities.
Similarly, a sales representative who also handles customer support could have both Sales and Customer support roles. This lets you assign each responsibility independently as people’s duties change.
Creating roles
Section titled “Creating roles”Attach roles to the organisation or to an organisational unit. Define a role such as Employee at the organisation level.
export const org = new Organisation({ name: "Demo",})
export const employee = new Role(org, "Employee", { name: "Employee",})Every employee would have this role, as this makes it possible to define processes accessible to all employees: requesting leave or creating a support ticket.
Attach the HR Manager role to the HR department:
const hr = new OrgUnit(org, "hr", { name: "Human Resources", type: "department",})
export const manager = new Role(hr, "Manager", { name: "Manager",})Managers could then be authorised to grant leave and authorise specific actions.
Assigning roles
Section titled “Assigning roles”Assigning roles in the Dashboard
Section titled “Assigning roles in the Dashboard”Users can be assigned roles after they have logged in. Go to
/settings/users in the Dashboard (Users & Sign-in):

Then click on a user, and assign roles under “Role Assignments”:

Tick or untick roles and save.
Assigning roles in code
Section titled “Assigning roles in code”Set the roles property on an Invitation to assign initial roles to a new
user. Using the roles defined above:
import { Invitation } from "@pf/process"
new Invitation(org, "alice", { email: "alice@example.com", roles: [employee, manager],})When Alice accepts the invitation, her user is created with both the Employee and Manager roles. These are initial role assignments: changing the invitation after acceptance does not change her roles. To update an existing user’s roles, use the Dashboard as described above.
See Invitations for more about creating and accepting invitations.