| 123456789101112131415161718192021222324252627282930313233 |
- import getMeta from '../../../utils/meta'
- import { DomainInfo } from '../components/emails/add-email/input'
- import { Institution } from '../../../../../types/institution'
- export const ssoAvailableForDomain = (
- domain: DomainInfo | null,
- isDomainCapturedByGroup: boolean
- ): domain is DomainInfo => {
- const { hasSamlBeta, hasSamlFeature } = getMeta('ol-ExposedSettings')
- if (!hasSamlFeature || !domain || !domain.confirmed || !domain.university) {
- return false
- }
- if (domain.university.ssoEnabled) {
- return true
- }
- if (isDomainCapturedByGroup && domain.group?.ssoConfig?.enabled) {
- return true
- }
- return Boolean(hasSamlBeta && domain.university.ssoBeta)
- }
- export const ssoAvailableForInstitution = (institution: Institution | null) => {
- const { hasSamlBeta, hasSamlFeature } = getMeta('ol-ExposedSettings')
- if (!hasSamlFeature || !institution || !institution.confirmed) {
- return false
- }
- if (institution.ssoEnabled) {
- return true
- }
- return hasSamlBeta && institution.ssoBeta
- }
|