Chapter 7. Delegating role-based access controls (RBAC) access in Red Hat Developer Hub
An enterprise customer requires the ability to delegate role-based access control (RBAC) responsibilities to other individuals in the organization. In this scenario, you, as the administrator, can provide access to the RBAC plugin specifically to designated users, such as team leads. Each team lead is then able to manage permissions exclusively for users within their respective team or department, without visibility into or control over permissions outside their assigned scope. This approach allows team leads to manage access and permissions for their own teams independently, while administrators maintain global oversight.
In Red Hat Developer Hub, you can delegate RBAC access using the multitenancy feature of the RBAC plugin, specifically the IS_OWNER conditional rule. You can either use the web UI or the RBAC backend API, depending on your preferred workflow and level of automation:
- Use the web UI to create roles, assign users or groups, define permissions, and apply ownership conditions through an intuitive interface.
- Use the API for a more flexible and automatable approach, where you can programmatically manage roles, permissions, and ownership conditions using authenticated curl requests.
By delegating RBAC access through either method, you can expect the following outcomes:
- Team leads can manage RBAC settings for their teams independently.
- Visibility of other users' or teams' permissions is restricted.
- Administrators retain overarching control while delegating team-specific access.
Prerequisites
- Your RHDH instance is running with the RBAC plugin installed and configured.
- You have administrative access to RHDH.
7.1. Delegating RBAC access in Red Hat Developer Hub by using the web UI Copy linkLink copied to clipboard!
You can delegate the RBAC access in Red Hat Developer Hub by using the web UI.
Procedure
- Log in to your RHDH instance with administrator credentials.
-
Navigate to Administration
RBAC. -
Click Create Role and define a new role for team leads, such as
role:default/team_lead. -
In the Members section, add the user or group, such as
user:default/team_lead. Grant permissions required by team leads, such as:
-
policy.entity.createto allow policy creation. -
catalog-entity:readto allow catalog access.
-
Apply conditions to limit access as follows:
-
Use the
IS_OWNERrule to ensure team leads can only manage resources they own.
-
Use the
- Click Save to create the role and apply changes.
Verification
- Log in as a team lead.
Verify the following:
- RBAC UI is accessible.
- Only users or roles related to their team are visible.
- No access to roles or permissions outside their scope is granted.
7.2. Delegating RBAC access in Red Hat Developer Hub by using API Copy linkLink copied to clipboard!
You can delegate the RBAC access in Red Hat Developer Hub by using the RBAC backend API.
Prerequisites
-
You have API access using
curlor another tool.
Procedure
Create a new role designated for team leads using the RBAC backend API:
Example of creating a new role for the team lead using the RBAC backend API
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Allow team leads to read catalog entities and create permissions in the RBAC plugin using the following API request:
Example of granting the team lead role permission to create RBAC policies and read catalog entities
Copy to Clipboard Copied! Toggle word wrap Toggle overflow To ensure team leads can only manage what they own, use the
IS_OWNERconditional rule as follows:Example
curlof applying a conditional access policy using theIS_OWNERrule for the team lead roleCopy to Clipboard Copied! Toggle word wrap Toggle overflow The previous example of conditional policy limits visibility and control to only owned roles and policies.
Log in to RHDH as team lead and verify the following:
Use the following request and verify that you do not see any roles:
Example
curlto retrieve roles visible to the team leadcurl -X GET 'http://localhost:7007/api/permission/roles' \ --header "Authorization: Bearer $TEAM_LEAD_TOKEN"
curl -X GET 'http://localhost:7007/api/permission/roles' \ --header "Authorization: Bearer $TEAM_LEAD_TOKEN"Copy to Clipboard Copied! Toggle word wrap Toggle overflow Use the following request to create a new role for their team:
Example
curlof team lead creating a new role for their team with ownership assignedCopy to Clipboard Copied! Toggle word wrap Toggle overflow NoteYou can set the ownership during creation, but you can also update the ownership at any time.
Use the following request to assign a permission policy to the new role:
Example
curlfor granting read access to catalog entities for the new roleCopy to Clipboard Copied! Toggle word wrap Toggle overflow Use the following request to verify that only team-owned roles and policies are visible:
Example
curlto retrieve roles and permission policies visible to the team leadcurl -X GET 'http://localhost:7007/api/permission/roles' \ --header "Authorization: Bearer $TEAM_LEAD_TOKEN" curl -X GET 'http://localhost:7007/api/permission/policies' \ --header "Authorization: Bearer $TEAM_LEAD_TOKEN"
curl -X GET 'http://localhost:7007/api/permission/roles' \ --header "Authorization: Bearer $TEAM_LEAD_TOKEN" curl -X GET 'http://localhost:7007/api/permission/policies' \ --header "Authorization: Bearer $TEAM_LEAD_TOKEN"Copy to Clipboard Copied! Toggle word wrap Toggle overflow
Verification
Log in as a team lead and verify the following:
- The RBAC UI is accessible.
- Only the assigned users or group is visible.
- Permissions outside the scoped team are not viewable or editable.
- Log in as an administrator and verify that you retain full visibility and control.