-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtransform_template.tmpl
More file actions
83 lines (80 loc) · 2.06 KB
/
transform_template.tmpl
File metadata and controls
83 lines (80 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
{{$status := "USER_STATUS_ACTIVE"}}
{{ if $.account_locked}}
{{$status = "USER_STATUS_SUSPENDED"}}
{{end}}
{
"objects": [
{{ if eq $.type "user" }}
{
"id": "{{ $.id }}",
"type": "user",
"display_name": "{{ $.firstname }} {{ $.middlename -}} {{ $.lastname }}",
"properties": {
{{ fromEnv "connection_id" "ASERTO_CONNECTION_ID" }},
"email": "{{ $.email }}",
"organization_id": "{{ $.organization }}",
"status": "{{ $status }}",
"user_id": "{{ $.id }}",
"username": "{{ $.username }}"
},
"created_at": "{{ $.created }}"
},
{
"id": "{{ $.email }}",
"type": "identity",
"display_name": "{{ $.firstname }} {{ $.middlename -}} {{ $.lastname }} (email)",
"properties": {
{{ fromEnv "connection_id" "ASERTO_CONNECTION_ID" }}
}
},
{
"id": "{{ $.username }}",
"type": "identity",
"display_name": "{{ $.firstname }} {{ $.middlename -}} {{ $.lastname }} (username)",
"properties": {
{{ fromEnv "connection_id" "ASERTO_CONNECTION_ID" }}
}
}
{{ end }}
{{ if eq $.type "user_group" }}
{
"id": "{{ $.name }}",
"type": "group",
"display_name": "{{ $.name }}",
"properties": {
{{ fromEnv "connection_id" "ASERTO_CONNECTION_ID" }}
}
}
{{ end }}
],
"relations": [
{{ if eq $.type "user" }}
{
"object_type": "user",
"object_id": "{{ $.id }}",
"relation": "identifier",
"subject_type": "identity",
"subject_id": "{{ $.email }}"
},
{
"object_type": "user",
"object_id": "{{ $.id }}",
"relation": "identifier",
"subject_type": "identity",
"subject_id": "{{ $.username }}"
}
{{ end }}
{{ if eq $.type "user_group" }}
{{ range $i, $user := $.users }}
{{ if $i }},{{ end }}
{
"object_type": "group",
"object_id": "{{ $.name }}",
"relation": "member",
"subject_type": "user",
"subject_id": "{{ $user.id }}"
}
{{ end }}
{{ end }}
]
}