@@ -13,7 +13,11 @@ allowed_paths := [
1313 " /domain.ClusterAccess/GetClusterAccess" ,
1414]
1515
16- scoped_paths := [{" path" : " /scim/" , " scope" : " WRITE_SCIM" }]
16+ scoped_paths := [{" scope" : " WRITE_SCIM" , " paths" : [
17+ " /scim/" ,
18+ " /eventsourcing.CommandHandler/Execute" ,
19+ " /domain.User/" ,
20+ ]}]
1721
1822command_path := " /eventsourcing.CommandHandler/Execute"
1923
@@ -25,6 +29,7 @@ role_admin = "admin"
2529
2630# check if system admin
2731is_system_admin {
32+ print (" entering is_system_admin" )
2833 some role in input.User.Roles
2934 role.Scope == scope_system
3035 role.Name == role_admin
@@ -33,6 +38,8 @@ is_system_admin {
3338
3439# check if user is tenant admin and adjusts rolebindings of other users of the tenant
3540tenant_admin_rolebindings {
41+ print (" entering tenant_admin_rolebindings" )
42+
3643 # check that it is a command
3744 startswith (input.Path, command_path)
3845 req := json.unmarshal (input.Request)
@@ -50,7 +57,7 @@ tenant_admin_rolebindings {
5057 role.Name == role_admin
5158 role.Resource == req.data.resource
5259
53- print (input.User.Name, " is tenant admin and allowed to execute" , req.type)
60+ print (input.User.Name, " is tenant admin and allowed to execute" , req.type, " for tenant " , req.data.resource )
5461}
5562
5663# authorized because system admin
@@ -65,16 +72,19 @@ authorized {
6572
6673# authorized via allowed_paths
6774authorized {
75+ print (" entering allowed_paths" )
6876 some path in allowed_paths
6977 startswith (input.Path, path)
7078 print (path, " is allowed to everyone" )
7179}
7280
7381# authorized via scope
7482authorized {
83+ print (" entering scoped_paths" )
7584 some scoped_path in scoped_paths
76- startswith (input.Path, scoped_path.path)
7785 some scope in input.Authentication.Scopes
7886 scope == scoped_path.scope
79- print (" scope" , scope, " allows access to path" , scoped_path.path)
87+ some path in scoped_path.paths
88+ startswith (input.Path, path)
89+ print (" scope" , scope, " allows access to path" , path)
8090}
0 commit comments