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'
|
2018-09-25 03:29:34 -04:00
|
|
|
return not Features.externalAuthenticationSystemUsed() or Settings.overleaf?
|
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-08-10 12:16:49 -04:00
|
|
|
when 'publish-templates'
|
|
|
|
return true
|
|
|
|
when 'view-templates'
|
2018-05-01 09:01:52 -04:00
|
|
|
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?
|
2018-07-16 09:20:53 -04:00
|
|
|
when 'rich-text'
|
2018-07-17 12:33:41 -04:00
|
|
|
isEnabled = true # Switch to false to disable
|
2018-07-16 09:20:53 -04:00
|
|
|
Settings.overleaf? and isEnabled
|
2018-08-07 09:54:23 -04:00
|
|
|
when 'redirect-sl'
|
2018-08-08 10:24:20 -04:00
|
|
|
return Settings.redirectToV2?
|
2017-11-20 06:43:02 -05:00
|
|
|
else
|
|
|
|
throw new Error("unknown feature: #{feature}")
|