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/apis.md
+32-16Lines changed: 32 additions & 16 deletions
Original file line number
Diff line number
Diff line change
@@ -454,11 +454,11 @@ Returns:
454
454
455
455
## Conditions
456
456
457
-
The Backstage permission framework provides conditions, and the RBAC backend plugin supports this feature. Conditions work like content filters for Backstage resources (provided by plugins). The RBAC backend plugin checks if a user has access to a particular resource. If the user has access to the resource, the RBAC backend API delegates the condition for this resource to the corresponding plugin by plugin ID.
457
+
The Backstage permission framework provides conditions, and the RBAC backend plugin supports this feature. Conditions work like content filters for Backstage resources (provided by plugins). The RBAC backend API stores conditions assigned to the role in the database. When a user requests access to the frontend resources, the RBAC backend API searches for corresponding conditions and delegates the condition for this resource to the corresponding plugin by its plugin ID. If a user was assigned to multiple roles, and each of these roles contains its own condition, the RBAC backend merges conditions using the anyOf criteria.
458
458
459
-
The corresponding plugin analyzes conditional parameters and makes a decision about which part of the content the user should see. Consequently, the user can view not all resource content but only some allowed parts. The RBAC backend plugin supports conditions on a generic level - conditions are bound to all roles but none to specific roles.
459
+
The corresponding plugin analyzes conditional parameters and makes a decision about which part of the content the user should see. Consequently, the user can view not all resource content but only some allowed parts. The RBAC backend plugin supports conditions bounded to the RBAC role.
460
460
461
-
A Backstage condition consists of a parameter or an array of parameters joined by criteria. The list of supported conditional criteria includes:
461
+
A Backstage condition can be a simple condition with a rule and parameters. But also a Backstage condition could consists of a parameter or an array of parameters joined by criteria. The list of supported conditional criteria includes:
462
462
463
463
- allOf
464
464
- anyOf
@@ -468,12 +468,14 @@ The plugin defines the supported condition parameters. API users can retrieve th
468
468
469
469
The structure of the condition JSON object is as follows:
| resourceType | Resource type provided by the plugin (e.g., "catalog-entity") | String |
478
+
| conditions | Condition JSON with parameters or array parameters joined by criteria | JSON |
477
479
478
480
### GET </plugins/condition-rules>
479
481
@@ -633,7 +635,7 @@ For example, consider a condition without criteria: displaying catalogs only if
633
635
- criteria: in this example, criteria are not used since we need to use only one conditional parameter
634
636
- params: from the schema, it is evident that it should be an object named "claims" with a string array. This string array constitutes a list of user or group string entity references.
635
637
636
-
Based on the above schema:
638
+
Based on the above schema condition is:
637
639
638
640
```json
639
641
{
@@ -645,13 +647,15 @@ Based on the above schema:
645
647
}
646
648
```
647
649
648
-
To utilize this condition to the RBAC REST api you need to wrap it with more info:
650
+
To utilize this condition to the RBAC REST api you need to wrap it with more info
649
651
650
652
```json
651
653
{
652
654
"result": "CONDITIONAL",
655
+
"roleEntityRef": "role:default/test",
653
656
"pluginId": "catalog",
654
657
"resourceType": "catalog-entity",
658
+
"permissionMapping": ["read"],
655
659
"conditions": {
656
660
"rule": "IS_ENTITY_OWNER",
657
661
"resourceType": "catalog-entity",
@@ -699,8 +703,10 @@ To utilize this condition to the RBAC REST api you need to wrap it with more inf
699
703
```json
700
704
{
701
705
"result": "CONDITIONAL",
706
+
"roleEntityRef": "role:default/test",
702
707
"pluginId": "catalog",
703
708
"resourceType": "catalog-entity",
709
+
"permissionMapping": ["read"],
704
710
"conditions": {
705
711
"anyOf": [
706
712
{
@@ -726,7 +732,7 @@ To utilize this condition to the RBAC REST api you need to wrap it with more inf
726
732
727
733
### POST condition
728
734
729
-
POST </api/permission/conditions>
735
+
POST </api/permission/roles/conditions>
730
736
731
737
Creates a new condition.
732
738
@@ -737,8 +743,10 @@ body:
737
743
```json
738
744
{
739
745
"result": "CONDITIONAL",
746
+
"roleEntityRef": "role:default/test",
740
747
"pluginId": "catalog",
741
748
"resourceType": "catalog-entity",
749
+
"permissionMapping": ["read"],
742
750
"conditions": {
743
751
"rule": "IS_ENTITY_OWNER",
744
752
"resourceType": "catalog-entity",
@@ -761,7 +769,7 @@ Returns a status code of 201 and json with id upon success:
761
769
762
770
### PUT condition
763
771
764
-
PUT </permission/conditions/:id>
772
+
PUT </permission/roles/conditions/:id>
765
773
766
774
Update conditions by id.
767
775
@@ -772,8 +780,10 @@ body:
772
780
```json
773
781
{
774
782
"result": "CONDITIONAL",
783
+
"roleEntityRef": "role:default/test",
775
784
"pluginId": "catalog",
776
785
"resourceType": "catalog-entity",
786
+
"permissionMapping": ["read"],
777
787
"conditions": {
778
788
"anyOf": [
779
789
{
@@ -801,15 +811,18 @@ Returns a status code of 200 upon success.
801
811
802
812
### Get condition by id
803
813
804
-
GET </api/permission/conditions/:id>
814
+
GET </api/permission/roles/conditions/:id>
805
815
806
816
Returns condition by id:
807
817
808
818
```json
809
819
{
820
+
"id": 1,
810
821
"result": "CONDITIONAL",
822
+
"roleEntityRef": "role:default/test",
811
823
"pluginId": "catalog",
812
824
"resourceType": "catalog-entity",
825
+
"permissionMapping": ["read"],
813
826
"conditions": {
814
827
"anyOf": [
815
828
{
@@ -837,16 +850,19 @@ Returns a status code of 200 upon success.
837
850
838
851
### GET conditions
839
852
840
-
GET </api/permission/conditions>
853
+
GET </api/permission/roles/conditions>
841
854
842
855
Returns lists all conditions:
843
856
844
857
```json
845
858
[
846
859
{
860
+
"id": 1,
847
861
"result": "CONDITIONAL",
862
+
"roleEntityRef": "role:default/test",
848
863
"pluginId": "catalog",
849
864
"resourceType": "catalog-entity",
865
+
"permissionMapping": ["read"],
850
866
"conditions": {
851
867
"anyOf": [
852
868
{
@@ -875,7 +891,7 @@ Returns a status code of 200 upon success.
0 commit comments