2017-11-20 11:43:02 +00: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 10:44:13 +00:00
|
|
|
when 'homepage'
|
|
|
|
return Settings.enableHomepage
|
2017-11-20 11:43:02 +00:00
|
|
|
when 'registration'
|
|
|
|
return not Features.externalAuthenticationSystemUsed()
|
2017-11-20 11:48:06 +00:00
|
|
|
when 'github-sync'
|
2017-11-22 10:44:57 +00:00
|
|
|
return Settings.enableGithubSync
|
2018-01-31 10:05:56 +00:00
|
|
|
when 'v1-return-message'
|
|
|
|
return Settings.accountMerge? and Settings.overleaf?
|
2018-05-14 09:29:42 +00:00
|
|
|
when 'v2-banner'
|
|
|
|
return Settings.showV2Banner
|
2018-03-22 12:10:34 +00:00
|
|
|
when 'custom-togglers'
|
|
|
|
return Settings.overleaf?
|
2018-08-10 16:16:49 +00:00
|
|
|
when 'publish-templates'
|
|
|
|
return true
|
|
|
|
when 'view-templates'
|
2018-05-01 13:01:52 +00:00
|
|
|
return !Settings.overleaf?
|
2018-07-05 16:26:12 +00:00
|
|
|
when 'affiliations'
|
2018-07-06 12:45:34 +00:00
|
|
|
return Settings?.apis?.v1?.url?
|
2018-07-16 13:20:53 +00:00
|
|
|
when 'rich-text'
|
2018-07-17 16:33:41 +00:00
|
|
|
isEnabled = true # Switch to false to disable
|
2018-07-16 13:20:53 +00:00
|
|
|
Settings.overleaf? and isEnabled
|
2018-08-07 13:54:23 +00:00
|
|
|
when 'redirect-sl'
|
2018-08-08 14:24:20 +00:00
|
|
|
return Settings.redirectToV2?
|
2017-11-20 11:43:02 +00:00
|
|
|
else
|
|
|
|
throw new Error("unknown feature: #{feature}")
|