You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: plugins/rbac-backend/docs/conditions.md
+38-2Lines changed: 38 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -274,13 +274,49 @@ To utilize this condition to the RBAC REST api you need to wrap it with more inf
274
274
}
275
275
```
276
276
277
+
## Conditional Policy Aliases
278
+
279
+
The RBAC-backend plugin allows for the use of aliases in the conditional policy rule parameters. These aliases are dynamically replaced with corresponding values during the policy evaluation process. Each alias is prefixed with a `$` sign to denote its special function.
280
+
281
+
### Supported Aliases
282
+
283
+
1.**`$currentUser`**:
284
+
285
+
-**Description**: This alias is replaced with the user entity reference for the user currently requesting access to the resource.
286
+
-**Example**: If the user "Tom" from the "default" namespace is requesting access, `$currentUser` will be replaced with `user:default/tom`.
287
+
288
+
2.**`$ownerRefs`**:
289
+
-**Description**: This alias is replaced with ownership references, typically in the form of an array. The array usually contains the user entity reference and the user's parent group entity reference.
290
+
-**Example**: For a user "Tom" who belongs to "team-a", `$ownerRefs` will be replaced with `['user:default/tom', 'group:default/team-a']`.
291
+
292
+
### Example of a Conditional Policy Object with Alias
293
+
294
+
This condition should allow members of the `role:default/developer` to delete only their own catalogs and no others:
295
+
296
+
```json
297
+
{
298
+
"result": "CONDITIONAL",
299
+
"roleEntityRef": "role:default/developer",
300
+
"pluginId": "catalog",
301
+
"resourceType": "catalog-entity",
302
+
"permissionMapping": ["delete"],
303
+
"conditions": {
304
+
"rule": "IS_ENTITY_OWNER",
305
+
"resourceType": "catalog-entity",
306
+
"params": {
307
+
"claims": ["$currentUser"]
308
+
}
309
+
}
310
+
}
311
+
```
312
+
277
313
## Examples of Conditional Policies
278
314
279
315
Below are a few examples that can be used on some of the Janus IDP plugins. These can help in determining how based to define conditional policies
280
316
281
317
### Keycloak plugin
282
318
283
-
```JSON
319
+
```json
284
320
{
285
321
"result": "CONDITIONAL",
286
322
"roleEntityRef": "role:default/developer",
@@ -303,7 +339,7 @@ Notice the use of the annotation `keycloak.org/realm` requires the value of `<YO
0 commit comments