mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 06:33:55 +01:00
Merge pull request #7841 from overleaf/ii-refactor-add-email
Refactor add email section GitOrigin-RevId: 41de440caaf3baf43673c4a5f07a18b990f28c7b
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
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))
|
||||
}
|
||||
Reference in New Issue
Block a user