Mirror of https://github.com/roostorg/coop github.com/roostorg/coop
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 22 lines 739 B view raw
1import type { Kysely } from 'kysely'; 2 3import { inject } from '../../iocContainer/index.js'; 4import type { SSOServicePg } from './dbTypes.js'; 5 6export class SSOService { 7 constructor(private readonly pgQuery: Kysely<SSOServicePg>) {} 8 9 // Throws is SSO is not enabled for an org 10 async getSSORedirectUrlForUserEmail(email: string) { 11 const { org_id: orgId } = await this.pgQuery 12 .selectFrom('users') 13 .innerJoin('org_settings', 'users.org_id', 'org_settings.org_id') 14 .where('users.email', '=', email) 15 .where('org_settings.saml_enabled', '=', true) 16 .select('users.org_id') 17 .executeTakeFirstOrThrow(); 18 return `/api/v1/saml/login/${orgId}`; 19 } 20} 21 22export default inject(['KyselyPg'], SSOService);