mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-14 20:40:17 -05:00
c807bedb65
Refactor add email section GitOrigin-RevId: 41de440caaf3baf43673c4a5f07a18b990f28c7b
23 lines
816 B
TypeScript
23 lines
816 B
TypeScript
import getMeta from '../../../utils/meta'
|
|
import { InstitutionInfo } from '../components/emails/add-email/input'
|
|
import { ExposedSettings } from '../../../../../types/exposed-settings'
|
|
import { Nullable } from '../../../../../types/utils'
|
|
|
|
const ssoAvailableForDomain = (domain: InstitutionInfo | null) => {
|
|
const { hasSamlBeta, hasSamlFeature } = getMeta(
|
|
'ol-ExposedSettings'
|
|
) as ExposedSettings
|
|
if (!hasSamlFeature || !domain || !domain.confirmed || !domain.university) {
|
|
return false
|
|
}
|
|
if (domain.university.ssoEnabled) {
|
|
return true
|
|
}
|
|
return hasSamlBeta && domain.university.ssoBeta
|
|
}
|
|
|
|
export const isSsoAvailable = (
|
|
institutionInfo: Nullable<InstitutionInfo>
|
|
): institutionInfo is InstitutionInfo => {
|
|
return Boolean(institutionInfo && ssoAvailableForDomain(institutionInfo))
|
|
}
|