overleaf/services/web/app/coffee/infrastructure/Features.coffee
James Allen e7a4aeaf79 Merge pull request #560 from sharelatex/ja-enable-v2-for-all
Enable the v2 banner for everyone if showV2Banner is set
2018-05-17 11:55:21 +01:00

24 lines
715 B
CoffeeScript

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
when 'registration'
return not Features.externalAuthenticationSystemUsed()
when 'github-sync'
return Settings.enableGithubSync
when 'v1-return-message'
return Settings.accountMerge? and Settings.overleaf?
when 'v2-banner'
return Settings.showV2Banner
when 'custom-togglers'
return Settings.overleaf?
when 'templates'
return !Settings.overleaf?
else
throw new Error("unknown feature: #{feature}")