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
Descope supports full relation based access control (ReBAC) using a zanzibar like schema and operations.
852
+
A schema is comprized of namespaces (entities like documents, folders, orgs, etc.) and each namespace has relation definitions to define relations.
853
+
Each relation definition can be simple (either you have it ornot) orcomplex (union of nodes).
854
+
855
+
A simple example for a file system like schema would be:
856
+
857
+
```yaml
858
+
# Example schema for the authz tests
859
+
name: Files
860
+
namespaces:
861
+
- name: org
862
+
relationDefinitions:
863
+
- name: parent
864
+
- name: member
865
+
complexDefinition:
866
+
nType: union
867
+
children:
868
+
- nType: child
869
+
expression:
870
+
neType: self
871
+
- nType: child
872
+
expression:
873
+
neType: relationLeft
874
+
relationDefinition: parent
875
+
relationDefinitionNamespace: org
876
+
targetRelationDefinition: member
877
+
targetRelationDefinitionNamespace: org
878
+
- name: folder
879
+
relationDefinitions:
880
+
- name: parent
881
+
- name: owner
882
+
complexDefinition:
883
+
nType: union
884
+
children:
885
+
- nType: child
886
+
expression:
887
+
neType: self
888
+
- nType: child
889
+
expression:
890
+
neType: relationRight
891
+
relationDefinition: parent
892
+
relationDefinitionNamespace: folder
893
+
targetRelationDefinition: owner
894
+
targetRelationDefinitionNamespace: folder
895
+
- name: editor
896
+
complexDefinition:
897
+
nType: union
898
+
children:
899
+
- nType: child
900
+
expression:
901
+
neType: self
902
+
- nType: child
903
+
expression:
904
+
neType: relationRight
905
+
relationDefinition: parent
906
+
relationDefinitionNamespace: folder
907
+
targetRelationDefinition: editor
908
+
targetRelationDefinitionNamespace: folder
909
+
- nType: child
910
+
expression:
911
+
neType: targetSet
912
+
targetRelationDefinition: owner
913
+
targetRelationDefinitionNamespace: folder
914
+
- name: viewer
915
+
complexDefinition:
916
+
nType: union
917
+
children:
918
+
- nType: child
919
+
expression:
920
+
neType: self
921
+
- nType: child
922
+
expression:
923
+
neType: relationRight
924
+
relationDefinition: parent
925
+
relationDefinitionNamespace: folder
926
+
targetRelationDefinition: viewer
927
+
targetRelationDefinitionNamespace: folder
928
+
- nType: child
929
+
expression:
930
+
neType: targetSet
931
+
targetRelationDefinition: editor
932
+
targetRelationDefinitionNamespace: folder
933
+
- name: doc
934
+
relationDefinitions:
935
+
- name: parent
936
+
- name: owner
937
+
complexDefinition:
938
+
nType: union
939
+
children:
940
+
- nType: child
941
+
expression:
942
+
neType: self
943
+
- nType: child
944
+
expression:
945
+
neType: relationRight
946
+
relationDefinition: parent
947
+
relationDefinitionNamespace: doc
948
+
targetRelationDefinition: owner
949
+
targetRelationDefinitionNamespace: folder
950
+
- name: editor
951
+
complexDefinition:
952
+
nType: union
953
+
children:
954
+
- nType: child
955
+
expression:
956
+
neType: self
957
+
- nType: child
958
+
expression:
959
+
neType: relationRight
960
+
relationDefinition: parent
961
+
relationDefinitionNamespace: doc
962
+
targetRelationDefinition: editor
963
+
targetRelationDefinitionNamespace: folder
964
+
- nType: child
965
+
expression:
966
+
neType: targetSet
967
+
targetRelationDefinition: owner
968
+
targetRelationDefinitionNamespace: doc
969
+
- name: viewer
970
+
complexDefinition:
971
+
nType: union
972
+
children:
973
+
- nType: child
974
+
expression:
975
+
neType: self
976
+
- nType: child
977
+
expression:
978
+
neType: relationRight
979
+
relationDefinition: parent
980
+
relationDefinitionNamespace: doc
981
+
targetRelationDefinition: viewer
982
+
targetRelationDefinitionNamespace: folder
983
+
- nType: child
984
+
expression:
985
+
neType: targetSet
986
+
targetRelationDefinition: editor
987
+
targetRelationDefinitionNamespace: doc
988
+
```
989
+
990
+
Descope SDK allows you to fully manage the schema and relations as well as perform simple (andnot so simple) checks regarding the existence of relations.
991
+
992
+
```python
993
+
# Load the existing schema
994
+
schema = descope_client.mgmt.authz.load_schema()
995
+
996
+
# Save schema and make sure to remove all namespaces not listed
0 commit comments