Skip to content

Commit 16f4d99

Browse files
committed
invite updates
1 parent 280eedb commit 16f4d99

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

crates/control-plane-api/src/server/public/graphql/invite_links.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,13 @@ impl InviteLinksMutation {
214214
// invite recipient directly into the correct SSO flow.
215215
let tenant = catalog_prefix
216216
.as_str()
217-
.split_at(catalog_prefix.as_str().find('/').expect("prefix must contain '/'") + 1)
217+
.split_at(
218+
catalog_prefix
219+
.as_str()
220+
.find('/')
221+
.expect("prefix must contain '/'")
222+
+ 1,
223+
)
218224
.0;
219225

220226
let sso_provider_id = sqlx::query_scalar!(
@@ -292,7 +298,13 @@ impl InviteLinksMutation {
292298
// amr claim to verify the current session used SSO.
293299
let tenant = invite
294300
.catalog_prefix
295-
.split_at(invite.catalog_prefix.find('/').expect("prefix must contain '/'") + 1)
301+
.split_at(
302+
invite
303+
.catalog_prefix
304+
.find('/')
305+
.expect("prefix must contain '/'")
306+
+ 1,
307+
)
296308
.0;
297309

298310
let sso_blocking_tenant = sqlx::query_scalar!(
@@ -304,8 +316,7 @@ impl InviteLinksMutation {
304316
AND NOT EXISTS (
305317
SELECT 1 FROM auth.identities ai
306318
WHERE ai.user_id = $2
307-
AND ai.provider = 'sso'
308-
AND ai.provider_id = t.sso_provider_id::text
319+
AND ai.provider = 'sso:' || t.sso_provider_id::text
309320
)
310321
"#,
311322
tenant,
@@ -316,8 +327,7 @@ impl InviteLinksMutation {
316327

317328
if let Some(tenant) = sso_blocking_tenant {
318329
return Err(async_graphql::Error::new(format!(
319-
"Tenant {} requires SSO authentication. Please sign in with the organization's SSO provider to redeem this invite.",
320-
tenant,
330+
"Tenant {tenant} requires SSO authentication. Please sign in with the organization's SSO provider to redeem this invite."
321331
)));
322332
}
323333

0 commit comments

Comments
 (0)