added scope link to Member role of context

This commit is contained in:
Marco Lettere 2022-07-22 14:55:55 +02:00
parent 362ab27344
commit 2d8c576160
2 changed files with 70 additions and 4 deletions

View File

@ -4,7 +4,7 @@ workflows:
# - group_deleted
# - user-group_created
# - user-group-role_created
- group_created
# - group_created
# - invitation-accepted
# - user-group_deleted
# - user-group-role_deleted
@ -26,7 +26,7 @@ workflows:
# - ghn_client_delete
# - ghn_client_remove_from_contexts
# - ghn_client_remove_from_context
# - jupyterhub_add_serveroptions_to_context
- jupyterhub_add_serveroptions_to_context
keycloak_host: "https://accounts.dev.d4science.org/auth"
keycloak: "{{ keycloak_host }}/realms"

View File

@ -60,6 +60,46 @@
"decisionCases": {},
"defaultCase": [],
"forkTasks": [
[
{
"name": "pyrest",
"taskReferenceName": "lookup_client",
"inputParameters": {
"url": "${init.input.keycloak_admin}/clients",
"params": {
"clientId": "${init.output.result.encoded_context}"
},
"method": "GET",
"headers": {
"Authorization": "Bearer ${authorize.output.body.access_token}",
"Accept": "application/json"
}
},
"type": "SIMPLE"
},
{
"name": "pyrest",
"taskReferenceName": "get_client_member_role",
"inputParameters": {
"url": "${init.input.keycloak_admin}/clients/${lookup_client.output.body[0].id}/roles/Member",
"method": "GET",
"headers": {
"Authorization": "Bearer ${authorize.output.body.access_token}",
"Accept": "application/json"
}
},
"type": "SIMPLE"
},
{
"name": "jq_1",
"taskReferenceName": "role_to_array",
"type": "JSON_JQ_TRANSFORM",
"inputParameters": {
"role": "${get_client_member_role.output.body}",
"queryExpression" : ".role"
}
}
],
[
{
"name": "pyrest",
@ -287,8 +327,34 @@
"name": "join",
"taskReferenceName": "join_parallel_tasks",
"inputParameters": {},
"type": "JOIN",
"decisionCases": {},
"type": "JOIN"
},
{
"name": "check_at_least_one",
"taskReferenceName": "check_at_least_one",
"inputParameters": {
"tasks": "${join_parallel_tasks.input.*}"
},
"type": "DECISION",
"caseExpression": "($.tasks.length > 0 ? 'true' : 'false')",
"decisionCases": {
"true": [
{
"name": "pyrest",
"taskReferenceName": "enable_jupyterhub_scope_for_context",
"inputParameters": {
"url": "${init.input.keycloak_admin}/clients/${lookup_jupyterhub.output.body[0].id}/scope-mappings/clients/${lookup_client.output.body[0].id}",
"method": "POST",
"headers": {
"Authorization": "Bearer ${authorize.output.body.access_token}",
"Content-Type": "application/json"
},
"body": "${role_to_array.output.resultList}"
},
"type": "SIMPLE"
}
]
},
"defaultCase": [],
"forkTasks": [],
"startDelay": 0,