Skip to content

Commit 103f5fa

Browse files
committed
Incorporated APIs
1 parent 0a52ee2 commit 103f5fa

File tree

1 file changed

+157
-13
lines changed

1 file changed

+157
-13
lines changed
Lines changed: 157 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
[id='proc-delegating-rbac-access_{context}']
22
= Delegating role-based access controls (RBAC) access in {product}
33

4-
An enterprise customer requires the ability to delegate role-based access control (RBAC) responsibilities to individual team leads. 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.
4+
An enterprise customer requires the ability to delegate role-based access control (RBAC) responsibilities to other individual 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.
55

6-
The expected results of delegating RBAC access are as follows:
6+
In {product-very-short}, you can delegate RBAC access using the multitenancy feature of RBAC plugin, specifically the `IS_OWNER` conditional rule.
7+
8+
By delegating the RBAC access, you can expect the following outcomes:
79

810
* Team leads can manage RBAC settings for their teams independently.
911
* Visibility of other users' or teams' permissions is restricted.
@@ -12,24 +14,166 @@ The expected results of delegating RBAC access are as follows:
1214
.Prerequisites
1315
* Your {product-very-short} instance is up and running with RBAC plugin installed and configured.
1416
* You have administrative access to {product-very-short}.
17+
* You have API access using `curl` or another tool.
1518

1619
.Procedure
1720
. In your {product-very-short} instance, navigate to the *Administration -> RBAC* page.
18-
. Create a new role designated for team leads.
21+
. Create a new role designated for team leads using the Web UI or API:
1922
+
20-
For more information about creating a role, see xref:proc-rbac-ui-create-role_title-authorization[Creating a role in the {product} Web UI].
23+
--
24+
.Example of creating a new role for the team lead using the RBAC backend API
25+
[source,bash]
26+
----
27+
curl -X POST 'http://localhost:7007/api/permission/roles' \
28+
--header "Authorization: Bearer $ADMIN_TOKEN" \
29+
--header "Content-Type: application/json" \
30+
--data '{
31+
"memberReferences": ["user:default/team_lead"],
32+
"name": "role:default/team_lead",
33+
"metadata": {
34+
"description": "This is an example team lead role"
35+
}
36+
}'
37+
----
2138

22-
. Add the appropriate users or groups to the newly created role.
23-
. Define the necessary permissions for the role based on the tasks the team leads are expected to manage. For example, you can allow team leads to access the RBAC UI and save permission changes for added users or groups.
24-
. Apply access conditions to scope the role’s visibility and control to specific users or groups. For example, you can limit each team lead’s access to only their team.
25-
. Save the changes.
39+
For more information about creating a role using the Web UI, see xref:proc-rbac-ui-create-role_title-authorization[Creating a role in the {product} Web UI].
40+
--
2641

27-
.Verification
28-
Log in as a team lead and verify the following:
42+
. Allow team leads to read catalog entities and create permissions in the RBAC plugin using the Web UI or the following API request:
43+
+
44+
--
45+
.Example of granting the team lead role permission to create RBAC policies and read catalog entities
46+
[source,bash]
47+
----
48+
curl -X POST 'http://localhost:7007/api/permission/policies' \
49+
--header "Authorization: Bearer $ADMIN_TOKEN" \
50+
--header "Content-Type: application/json" \
51+
--data '[
52+
{
53+
"entityReference": "role:default/team_lead",
54+
"permission": "policy-entity",
55+
"policy": "create",
56+
"effect": "allow"
57+
},
58+
{
59+
"entityReference": "role:default/team_lead",
60+
"permission": "catalog-entity",
61+
"policy": "read",
62+
"effect": "allow"
63+
}
64+
]'
65+
----
66+
--
67+
68+
. To ensure team leads can only manage what they own, use the `IS_OWNER` conditional rule as follows:
69+
+
70+
--
71+
.Example `curl` of applying a conditional access policy using the `IS_OWNER` rule for the team lead role
72+
[source,bash]
73+
----
74+
curl -X POST 'http://localhost:7007/api/permission/roles/conditions' \
75+
--header "Authorization: Bearer $ADMIN_TOKEN" \
76+
--header "Content-Type: application/json" \
77+
--data '{
78+
"result": "CONDITIONAL",
79+
"pluginId": "permission",
80+
"resourceType": "policy-entity",
81+
"conditions": {
82+
"rule": "IS_OWNER",
83+
"resourceType": "policy-entity",
84+
"params": {
85+
"owners": [
86+
"user:default/team_lead"
87+
]
88+
}
89+
},
90+
"roleEntityRef": "role:default/team_lead",
91+
"permissionMapping": [
92+
"read",
93+
"update",
94+
"delete"
95+
]
96+
}'
97+
----
98+
The previous example of conditional policy limits visibility and control to only owned roles and policies.
99+
--
29100

30-
* The RBAC UI is accessible.
31-
* Only the assigned users or group is visible.
32-
* Permissions outside the scoped team are not viewable or editable.
101+
. Log in to {product-very-short} as team lead and verify the following:
102+
+
103+
--
104+
.. Use the following request and verify that you do not see any roles:
105+
+
106+
.Example `curl` to retrieve roles visible to the team lead
107+
[source,bash]
108+
----
109+
curl -X GET 'http://localhost:7007/api/permission/roles' \
110+
--header "Authorization: Bearer $TEAM_LEAD_TOKEN"
111+
112+
----
113+
114+
.. Use the following request to create a new role for their team:
115+
+
116+
.Example `curl` of team lead creating a new role for their team with ownership assigned
117+
[source,bash]
118+
----
119+
curl -X POST 'http://localhost:7007/api/permission/roles' \
120+
--header "Authorization: Bearer $TEAM_LEAD_TOKEN" \
121+
--header "Content-Type: application/json" \
122+
--data '{
123+
"memberReferences": ["user:default/team_member"],
124+
"name": "role:default/team_a",
125+
"metadata": {
126+
"description": "This is an example team_a role",
127+
"owner": "user:default/team_lead"
128+
}
129+
}'
130+
----
131+
+
132+
[NOTE]
133+
====
134+
You can set the ownership during creation but you can also update the ownership at any time.
135+
====
136+
137+
.. Use the following request to assign a permission policy to the new role:
138+
+
139+
.Example `curl` for granting read access to catalog entities for the new role
140+
[source,bash]
141+
----
142+
curl -X POST 'http://localhost:7007/api/permission/policies' \
143+
--header "Authorization: Bearer $ADMIN_TOKEN" \
144+
--header "Content-Type: application/json" \
145+
--data '[
146+
{
147+
"entityReference": "role:default/team_a",
148+
"permission": "catalog-entity",
149+
"policy": "read",
150+
"effect": "allow"
151+
}
152+
]'
153+
----
154+
155+
.. Use the following request to verify that only team-owned roles and policies are visible:
156+
+
157+
.Example `curl` to retrieve roles and permission policies visible to the team lead
158+
[source,bash]
159+
----
160+
curl -X GET 'http://localhost:7007/api/permission/roles' \
161+
--header "Authorization: Bearer $TEAM_LEAD_TOKEN"
162+
163+
curl -X GET 'http://localhost:7007/api/permission/policies' \
164+
--header "Authorization: Bearer $TEAM_LEAD_TOKEN"
165+
----
166+
--
167+
168+
.Verification
169+
* Log in as a team lead and verify the following:
170+
+
171+
--
172+
** The RBAC UI is accessible.
173+
** Only the assigned users or group is visible.
174+
** Permissions outside the scoped team are not viewable or editable.
175+
--
176+
* Log in as an administrator and verify that you retain full visibility and conrol
33177

34178

35179

0 commit comments

Comments
 (0)