overleaf/services/web/app/coffee/infrastructure/Features.coffee

25 lines
715 B
CoffeeScript
Raw Normal View History

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
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'
return Settings.enableGithubSync
when 'v1-return-message'
return Settings.accountMerge? and Settings.overleaf?
when 'v2-banner'
return Settings.showV2Banner
2018-03-22 08:10:34 -04:00
when 'custom-togglers'
return Settings.overleaf?
when 'templates'
return !Settings.overleaf?
2017-11-20 06:43:02 -05:00
else
throw new Error("unknown feature: #{feature}")