-
Notifications
You must be signed in to change notification settings - Fork 16
docs: improve rbac and permissions #391
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| --- | ||
| title: Role-Based Access Control | ||
| sidebar_label: Overview | ||
| description: Learn how PactFlow manages access through users, teams, roles, and permissions. | ||
| --- | ||
|
|
||
| # Role-Based Access Control | ||
|
|
||
| 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. | ||
|
|
||
| This model supports simple team structures and scales to complex organizations. | ||
|
|
||
| ## Core concepts | ||
|
|
||
| - **Users**: Individuals who interact with PactFlow via the UI, API, or CLI. | ||
mefellows marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - **Roles**: Global collections of permissions assigned to users. | ||
| - **Permissions**: Actions a user can perform. Some may be scoped to specific teams or resources. | ||
| - **Teams**: Logical groups of users that own applications and resources. | ||
| - **Applications**: Team-owned services that participate in contract testing. | ||
| - **Contracts**: The data generated from interactions between applications. | ||
| - **Resources**: Include secrets, webhooks, test results, and other team-scoped assets. | ||
|
|
||
| ## How it works | ||
|
|
||
| PactFlow uses a flexible RBAC model where: | ||
|
|
||
| - **Users are assigned one or more global roles** | ||
| - **Roles grant a set of permissions** | ||
| - **Some permissions are scoped to specific teams or resources** | ||
|
|
||
| While roles are assigned globally to a user, many permissions are evaluated in context — particularly when scoped to a team. | ||
|
|
||
| For example: | ||
|
|
||
| - A user with the `contract_data:manage:team` permission can modify contract data **only** for applications owned by teams they belong to. | ||
| - A user with `user:invite` (no scope) can invite users across the entire organization. | ||
|
|
||
| A user's **effective permissions** are therefore a combination of: | ||
|
|
||
| * Their globally assigned roles | ||
| * The permissions granted by those roles | ||
| * The team or resource scope (if applicable) of those permissions | ||
| * The teams they are a member of (when a permission is team-scoped) | ||
|
|
||
| ### Special case: Team Administrator | ||
|
|
||
| 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: | ||
|
|
||
| ``` | ||
| team:manage:{team_uuid} | ||
| ``` | ||
|
|
||
| This allows for delegated administration of a team without giving the user global administrative rights. | ||
|
|
||
| > **Note:** Roles are additive — there are no negated permissions in PactFlow. | ||
|
|
||
| ### Conceptual Model | ||
|
|
||
|  | ||
mefellows marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ## Example: Team-based access | ||
|
|
||
| This guide walks you through an example with two teams, three applications, and three users, one of whom is a platform administrator. | ||
|
|
||
| ### Team structure | ||
|
|
||
| | **Team** | **Applications** | **Users** | | ||
| |----------|------------------|-----------| | ||
| | A | ProductService, OrderService | Sally | | ||
| | B | OrderService, AuthService | Billy | | ||
|
|
||
| ### User access and roles | ||
|
|
||
| | **User** | **Team** | **Role** | **Access Rights** | | ||
| |----------|----------|-------------------|-------------------| | ||
| | Sally | A | Test Maintainer | ProductService, OrderService | | ||
| | Billy | B | Test Maintainer | OrderService, AuthService | | ||
| | Kevin | - | Administrator | All | | ||
|
|
||
| - Sally and Billy can only act on applications owned by their assigned teams. | ||
| - Kevin, as an Administrator, can access and manage any application or contract in the system. | ||
|
|
||
| If Sally attempts to publish a contract for an application not owned by her team (for example, `AuthService`), she will receive a permissions error. | ||
|
|
||
| Example error: | ||
|
|
||
| ``` | ||
| Failed to tag versions due to error: PactBroker::Client::Error – Authorization failed (403) | ||
| One or more pacts failed to be published | ||
| ``` | ||
|
|
||
| This demonstrates how access is enforced based on both ownership and role-based permissions. | ||
|
|
||
| > **Note:** See [Predefined Roles](/docs/permissions/predefined-roles) for more details on role capabilities. | ||
|
|
||
|
|
||
| ## More Information | ||
|
|
||
| * For a list of the default roles, visit the [Roles Overview](/docs/permissions/predefined-roles). | ||
| * For a list of supported permissions, visit the [Permissions Overview](/docs/permissions). | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.