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

17 lines
470 B
CoffeeScript
Raw Normal View History

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
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'
return Settings.enableGithubSync
2017-11-20 11:43:02 +00:00
else
throw new Error("unknown feature: #{feature}")