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-11-14 06:08:15 -05:00
|
|
|
when 'git-bridge'
|
|
|
|
return Settings.enableGitBridge
|
2018-01-31 05:05:56 -05:00
|
|
|
when 'v1-return-message'
|
2019-01-07 06:16:21 -05:00
|
|
|
return Settings.accountMerge? and Settings.overleaf? and !Settings.forceImportToV2
|
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?
|
2018-12-20 06:50:58 -05:00
|
|
|
when 'force-import-to-v2'
|
|
|
|
return Settings.forceImportToV2
|
2017-11-20 06:43:02 -05:00
|
|
|
else
|
|
|
|
throw new Error("unknown feature: #{feature}")
|