2017-11-20 06:43:02 -05:00
|
|
|
Settings = require 'settings-sharelatex'
|
|
|
|
|
|
|
|
module.exports = Features =
|
|
|
|
externalAuthenticationSystemUsed: ->
|
|
|
|
Settings.ldap? or Settings.saml? or Settings.overleaf?.oauth?
|
|
|
|
|
|
|
|
hasFeature: (feature) ->
|
|
|
|
switch feature
|
2017-11-22 05:44:13 -05:00
|
|
|
when 'homepage'
|
|
|
|
return Settings.enableHomepage
|
2017-11-20 06:43:02 -05:00
|
|
|
when 'registration'
|
|
|
|
return not Features.externalAuthenticationSystemUsed()
|
2017-11-20 06:48:06 -05:00
|
|
|
when 'github-sync'
|
2017-11-22 05:44:57 -05:00
|
|
|
return Settings.enableGithubSync
|
2018-01-31 05:05:56 -05:00
|
|
|
when 'v1-return-message'
|
|
|
|
return Settings.accountMerge? and Settings.overleaf?
|
2018-05-14 05:29:42 -04:00
|
|
|
when 'v2-banner'
|
|
|
|
return Settings.showV2Banner
|
2018-03-22 08:10:34 -04:00
|
|
|
when 'custom-togglers'
|
|
|
|
return Settings.overleaf?
|
2018-05-01 09:01:52 -04:00
|
|
|
when 'templates'
|
|
|
|
return !Settings.overleaf?
|
2018-07-05 12:26:12 -04:00
|
|
|
when 'affiliations'
|
2018-07-06 08:45:34 -04:00
|
|
|
return Settings?.apis?.v1?.url?
|
2017-11-20 06:43:02 -05:00
|
|
|
else
|
|
|
|
throw new Error("unknown feature: #{feature}")
|