- Notifications
You must be signed in to change notification settings - Fork1k
chore: implement OIDCClaimFieldValues for idp sync mappings auto complete#15576
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
0b20020
917ce36
1a5dc30
2ee347f
0ef9f10
614acc7
e04102f
dae9216
7852434
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.
Uh oh!
There was an error while loading.Please reload this page.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -58,7 +58,6 @@ SET | ||
WHERE | ||
user_id = $7 AND login_type = $8 RETURNING *; | ||
-- name: OIDCClaimFields :many | ||
-- OIDCClaimFields returns a list of distinct keys in the the merged_claims fields. | ||
-- This query is used to generate the list of available sync fields for idp sync settings. | ||
@@ -78,3 +77,36 @@ WHERE | ||
ELSE true | ||
END | ||
; | ||
-- name: OIDCClaimFieldValues :many | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Where is this being / going to be called? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. In the So if doing Group sync, this shows the user which IDP groups exist. | ||
SELECT | ||
-- DISTINCT to remove duplicates | ||
DISTINCT jsonb_array_elements_text(CASE | ||
-- When the type is an array, filter out any non-string elements. | ||
-- This is to keep the return type consistent. | ||
WHEN jsonb_typeof(claims->'merged_claims'->sqlc.arg('claim_field')::text) = 'array' THEN | ||
( | ||
SELECT | ||
jsonb_agg(element) | ||
FROM | ||
jsonb_array_elements(claims->'merged_claims'->sqlc.arg('claim_field')::text) AS element | ||
WHERE | ||
-- Filtering out non-string elements | ||
jsonb_typeof(element) = 'string' | ||
) | ||
-- Some IDPs return a single string instead of an array of strings. | ||
WHEN jsonb_typeof(claims->'merged_claims'->sqlc.arg('claim_field')::text) = 'string' THEN | ||
jsonb_build_array(claims->'merged_claims'->sqlc.arg('claim_field')::text) | ||
END) | ||
FROM | ||
user_links | ||
WHERE | ||
-- IDP sync only supports string and array (of string) types | ||
jsonb_typeof(claims->'merged_claims'->sqlc.arg('claim_field')::text) = ANY(ARRAY['string', 'array']) | ||
AND login_type = 'oidc' | ||
AND CASE | ||
WHEN @organization_id :: uuid != '00000000-0000-0000-0000-000000000000'::uuid THEN | ||
user_links.user_id = ANY(SELECT organization_members.user_id FROM organization_members WHERE organization_id = @organization_id) | ||
ELSE true | ||
END | ||
; |
Uh oh!
There was an error while loading.Please reload this page.