Skip to content

Commit 2d62c1f

Browse files
authored
docs: improve rbac and permissions (#391)
PACT-4283
1 parent 83b7d38 commit 2d62c1f

File tree

7 files changed

+190
-44
lines changed

7 files changed

+190
-44
lines changed

website/docs/docs/authentication/legacy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,4 +487,4 @@ You can discriminate between users based on the "identity provider" column in ou
487487

488488
You can't make the username/password login dialog disappear, however only users that have been manually invited by email can login with this option. Inviting users is controlled by the [`user:invite` permission](https://docs.pactflow.io/docs/permissions/#userinvite), which by default is only available to Administrators. You can use this permission to create custom roles as needed to control the desired behaviour.
489489

490-
Note it is wise to retain at least one administrative user who can login with a username and password to address break-glass scenarios (e.g., if your SSO provider is down or misconfigured).
490+
Note it is wise to retain at least one administrative user who can login with a username and password to address break-glass scenarios (for example, if your SSO provider is down or misconfigured).

website/docs/docs/authentication/main.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Once SSO has been enabled, any users on the registered SAML domain _must_ login
5151

5252
Users not attached to the SAML domain that have been invited may login using any form. Inviting users is controlled by the [`user:invite` permission](https://docs.pactflow.io/docs/permissions/#userinvite), which by default is only available to Administrators.
5353

54-
We recommend at least one administrative user who can login with a username and password to address break-glass scenarios (e.g., if your SSO provider is down or misconfigured).
54+
We recommend at least one administrative user who can login with a username and password to address break-glass scenarios (for example, if your SSO provider is down or misconfigured).
5555

5656
### 2. I'm an enterprise customer and need SCIM enabled
5757

website/docs/docs/permissions/permissions.md

Lines changed: 86 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,47 +4,80 @@ title: Permissions
44

55
_Eligible plans: Enterprise_
66

7-
Note that "manage" permissions cover both read and write operations.
7+
# Overview
88

9-
## ai:*
9+
PactFlow uses a structured permission model to define what users can do and where. Most permissions follow the format `resource:action:scope` , where:
10+
11+
- `resource` — the type of data or feature the permission applies to (for example, `contract_data`, `webhook`, `user`)
12+
- `action` — the operation being performed (for example, `read`, `write`, `manage`, `invite`)
13+
- `scope` — the level or context the permission applies to, such as:
14+
- `team` — restricts the permission to resources owned by teams the user belongs to
15+
- `*` — applies globally to all resources of that type
16+
- `{uuid}` — scoped to a specific team, used for fine-grained delegation (for example, `team:manage:{uuid}`)
17+
18+
Permissions are grant-only. Broader permissions cannot be narrowed by denial (for example, ai:* cannot exclude ai:generation:code).
19+
20+
> Note: `manage` permissions include both read and write access.
21+
22+
**Example:**
23+
`contract_data:manage:team` — allows a user to publish, modify, and view contract data for applications owned by any team they belong to.
24+
25+
While most permissions follow this pattern, there are a few exceptions. Refer to the sections below for a complete list of available permissions, including their effects and any additional constraints.
26+
27+
## AI
28+
29+
AI-related permissions are a special case. Instead of applying to data or resources, they control access to AI-powered features within PactFlow.
30+
31+
They are also **hierarchical**, meaning:
32+
33+
- Granting a broader permission (for example, `ai:*`) implies access to all sub-permissions within that namespace.
34+
- More specific permissions allow access to a narrower feature set.
35+
36+
> **Note:** AI permissions do not include a `scope`, because they do not act on specific team-owned resources. Access is granted globally based on role assignment.
37+
38+
### ai:*
1039
Provides access to all AI-related features, including all future permissions created under the `ai:` scope.
1140

12-
## ai:generation:*
41+
### ai:generation:*
1342
Can generate Pact tests from all current and future supported inputs.
1443

15-
## ai:generation:openapi
44+
### ai:generation:openapi
1645
Can generate Pact tests based on user-provided OpenAPI descriptions.
1746

18-
## ai:generation:code
47+
### ai:generation:code
1948
Can generate Pact tests based on user-provided client code.
2049

21-
## ai:generation:request-response
50+
### ai:generation:request-response
2251
Can generate Pact tests based on recorded request-response pairs.
2352

24-
# ai:generation:test-template
53+
### ai:generation:test-template
2554
Can customize generated Pact test output using a predefined example as a template.
2655

27-
## authentication_settings:manage
56+
## Authentication
57+
58+
### authentication_settings:manage
2859

2960
Manage authentication settings, such as configuring SSO via Github or Google.
3061

31-
## contract_data:bulk_delete:*
62+
## Application Data
63+
64+
### contract_data:bulk_delete:*
3265

3366
Bulk deletes pacts (which just removes the pacts and their associated verifications), applications (which removes associated pacts, verification results, application versions and webhooks) or an integration (which removes all pacts, verification results and webhooks, but leaves any application referenced by another integration).
3467

35-
## contract_data:bulk_delete:team
68+
### contract_data:bulk_delete:team
3669

3770
Bulk deletes pacts (see above) where the consumer is assigned to the user's teams.
3871

39-
## contract_data:bulk_delete:own
72+
### contract_data:bulk_delete:own
4073

4174
Bulk deletes pacts (see above) where the consumer was created by the logged in user.
4275

43-
## contract_data:manage:*
76+
### contract_data:manage:*
4477

4578
Create, update, and delete any contract related data. This includes applications, application labels, application versions, branches, tags, pacts, and verification results. It allows the user to delete a single pact, but it does not allow to perform bulk deletions. When deleting an application that has associated pacts and versions, you must also have the appropriate bulk delete permission (see also [contract_data:bulk_delete:\*](#contract_data-bulk_delete)).
4679

47-
## contract_data:manage:team
80+
### contract_data:manage:team
4881

4982
Create, update, and delete contract related data for applications assigned to the user's teams. Pacts are managed by the consumer's team(s) and verification results are managed by the provider's team(s).
5083

@@ -54,114 +87,126 @@ Some PactFlow resources, such as secrets and webhooks, have a team assigned at t
5487

5588
:::
5689

57-
## contract_data:manage:own
90+
### contract_data:manage:own
5891

5992
Create, update, and delete contract related data for applications created by the logged in user. This permission is required to create an application in PactFlow before it is assigned to a team.
6093

61-
## contract_data:read:*
94+
### contract_data:read:*
6295

6396
View any contract-related data. This includes applications, application labels, application versions, branches, tags, pacts, and verification results.
6497

65-
## deployment_and_release:record:*
98+
## Environment and Deployment
99+
100+
### deployment_and_release:record:*
66101

67102
Notify PactFlow that a particular version of an application has been deployed or released.
68103

69-
## deployment_and_release:record:team
104+
### deployment_and_release:record:team
70105

71106
Notify PactFlow that a particular version of an application associated with your team has been deployed or released.
72107

73-
## environment:manage:*
108+
### environment:manage:*
74109

75110
Create, update, and delete any environment. When creating a new environment, the user can associate it with any team.
76111

77-
## environment:read:*
112+
### environment:read:*
78113

79114
View a list of all environments.
80115

81-
## environment:read:team
116+
### environment:read:team
82117

83118
View a list of environments associated with the user's teams.
84119

85-
## read_token:manage:own
120+
## Tokens
121+
122+
### read_token:manage:own
86123

87124
Manage own *read only* API token. This permission is for users/system accounts that are not allowed to modify any resources (for example, those with the [Viewer](./predefined-roles#viewer) role), for whom it does not make sense to have a read/write token.
88125

89-
## role:manage:*
126+
## Roles
127+
128+
### role:manage:*
90129

91130
Create, update and delete roles (note that the pre-defined roles cannot be deleted).
92131

93-
## role:read:*
132+
### role:read:*
94133

95134
View all roles.
96135

97-
## secret:manage:*
136+
## Secrets
137+
138+
### secret:manage:*
98139

99140
Create, update and delete all secrets.
100141

101-
## secret:manage:team
142+
### secret:manage:team
102143

103144
Create, update and delete secrets assigned to teams of which the user is a member.
104145

105-
## secret:read:team
146+
### secret:read:team
106147

107148
View the names and descriptions of secrets assigned to teams of which the user is a member.
108149

109-
## system_account:manage:*
150+
## Users, System Accounts and Teams
151+
152+
### system_account:manage:*
110153

111154
Create, update, and disable any system account and associated API tokens.
112155

113-
## system_account:manage:team
156+
### system_account:manage:team
114157

115158
View details, disable, and copy and regenerate API tokens for system accounts assigned to the teams of which the user is a member. Does not currently allow system account creation, but this is expected to be supported in the future.
116159

117-
## system_account:read:*
160+
### system_account:read:*
118161

119162
View all system accounts (does not allow viewing/copying API tokens).
120163

121-
## system_account:read:team
164+
### system_account:read:team
122165

123166
View system accounts assigned to the teams of which the user is a member (does not allow viewing/copying API tokens).
124167

125-
## system_preference:manage:*
168+
### system_preference:manage:*
126169

127170
Manage the global system settings such as API token expiration and application notices.
128171

129-
## team:manage:*
172+
### team:manage:*
130173

131174
Create, update and delete teams. Add and remove users, environments and applications to/from teams.
132175

133-
## team:manage:{uuid}
176+
### team:manage:{uuid}
134177

135178
Manage administrators, users, environments and applications associated with a particular team. This permission is only associated with the [Team Administator](./predefined-roles#team-administrator) role and cannot be assigned to any other roles.
136179

137-
## team:read:*
180+
### team:read:*
138181

139182
View teams and their associated users and applications.
140183

141-
## token:manage:own
184+
### token:manage:own
142185

143186
Manage own read/write and read only API tokens.
144187

145-
## user:invite
188+
### user:invite
146189

147190
Invite a user to the PactFlow application.
148191

149-
## user:manage:*
192+
### user:manage:*
150193

151194
Create, update, and disable any regular user (not system accounts), and modify their roles.
152195

153-
## user:manage_scim_attributes:*
196+
### user:manage_scim_attributes:*
154197

155198
Set and update the user attributes used by the PactFlow SCIM API to identify the user in the external Identity Provider (`externalIdpUsername` and `externalIdpId`). Must be used in conjuction with `user:invite` and `user:manage` permissions. This permission can only be associated with the SCIM role.
156199

157-
## user:read:*
200+
### user:read:*
158201

159202
View all regular users (not system accounts) and their associated roles.
160203

161-
## webhook:manage:*
204+
## Webhooks
205+
206+
### webhook:manage:*
162207

163208
Create, update, and delete any webhook.
164209

165-
## webhook:manage:team
210+
### webhook:manage:team
166211

167212
Create, update and delete webhooks assigned to the teams of which the user is a member.
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
---
2+
title: Role-Based Access Control
3+
sidebar_label: Overview
4+
description: Learn how PactFlow manages access through users, teams, roles, and permissions.
5+
---
6+
7+
# Role-Based Access Control
8+
9+
PactFlow uses a flexible team-based Role-Based Access Control (RBAC) model to manage access to contracts, applications, and features. This ensures users can only interact with resources in ways allowed by their assigned roles and team membership.
10+
11+
This model supports simple team structures and scales to complex organizations.
12+
13+
## Core concepts
14+
15+
- **Users**: Individuals who interact with PactFlow via the UI, API, or CLI.
16+
- **Roles**: Global collections of permissions assigned to users.
17+
- **Permissions**: Actions a user can perform. Some may be scoped to specific teams or resources.
18+
- **Teams**: Logical groups of users that own applications and resources.
19+
- **Applications**: Team-owned services that participate in contract testing.
20+
- **Contracts**: The data generated from interactions between applications.
21+
- **Resources**: Include secrets, webhooks, test results, and other team-scoped assets.
22+
23+
## How it works
24+
25+
PactFlow uses a flexible RBAC model where:
26+
27+
- **Users are assigned one or more global roles**
28+
- **Roles grant a set of permissions**
29+
- **Some permissions are scoped to specific teams or resources**
30+
31+
While roles are assigned globally to a user, many permissions are evaluated in context — particularly when scoped to a team.
32+
33+
For example:
34+
35+
- A user with the `contract_data:manage:team` permission can modify contract data **only** for applications owned by teams they belong to.
36+
- A user with `user:invite` (no scope) can invite users across the entire organization.
37+
38+
A user's **effective permissions** are therefore a combination of:
39+
40+
* Their globally assigned roles
41+
* The permissions granted by those roles
42+
* The team or resource scope (if applicable) of those permissions
43+
* The teams they are a member of (when a permission is team-scoped)
44+
45+
### Special case: Team Administrator
46+
47+
The **Team Administrator** is a special permission-based role assigned to a user _for a specific team_. It is implemented using a scoped permission like:
48+
49+
```
50+
team:manage:{team_uuid}
51+
```
52+
53+
This allows for delegated administration of a team without giving the user global administrative rights.
54+
55+
> **Note:** Roles are additive — there are no negated permissions in PactFlow.
56+
57+
### Conceptual Model
58+
59+
![Diagram](/img/rbac.png)
60+
61+
## Example: Team-based access
62+
63+
This guide walks you through an example with two teams, three applications, and three users, one of whom is a platform administrator.
64+
65+
### Team structure
66+
67+
| **Team** | **Applications** | **Users** |
68+
|----------|------------------|-----------|
69+
| A | ProductService, OrderService | Sally |
70+
| B | OrderService, AuthService | Billy |
71+
72+
### User access and roles
73+
74+
| **User** | **Team** | **Role** | **Access Rights** |
75+
|----------|----------|-------------------|-------------------|
76+
| Sally | A | Test Maintainer | ProductService, OrderService |
77+
| Billy | B | Test Maintainer | OrderService, AuthService |
78+
| Kevin | - | Administrator | All |
79+
80+
- Sally and Billy can only act on applications owned by their assigned teams.
81+
- Kevin, as an Administrator, can access and manage any application or contract in the system.
82+
83+
If Sally attempts to publish a contract for an application not owned by her team (for example, `AuthService`), she will receive a permissions error.
84+
85+
Example error:
86+
87+
```
88+
Failed to tag versions due to error: PactBroker::Client::Error – Authorization failed (403)
89+
One or more pacts failed to be published
90+
```
91+
92+
This demonstrates how access is enforced based on both ownership and role-based permissions.
93+
94+
> **Note:** See [Predefined Roles](/docs/permissions/predefined-roles) for more details on role capabilities.
95+
96+
97+
## More Information
98+
99+
* For a list of the default roles, visit the [Roles Overview](/docs/permissions/predefined-roles).
100+
* For a list of supported permissions, visit the [Permissions Overview](/docs/permissions).

website/docs/docs/troubleshooting/apihub.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ https://app.pactflow.io
9999
- Directed to their default tenant, or
100100
- Presented with a list of organisations they belong to.
101101

102-
> Your existing tenant-specific URL (e.g., `xyz.pactflow.io`) will continue to work.
102+
> Your existing tenant-specific URL (for example, `xyz.pactflow.io`) will continue to work.
103103
104104
### Website and Marketing Collateral
105105

website/sidebars.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ module.exports = {
7878
type: "category",
7979
label: "Roles and permissions",
8080
items: [
81+
"docs/permissions/rbac",
8182
"docs/permissions/predefined-roles",
8283
"docs/permissions/permissions",
8384
"docs/permissions/api-tokens",

website/static/img/rbac.png

324 KB
Loading

0 commit comments

Comments
 (0)