Features.coffee 664 B

12345678910111213141516171819202122
  1. Settings = require 'settings-sharelatex'
  2. module.exports = Features =
  3. externalAuthenticationSystemUsed: ->
  4. Settings.ldap? or Settings.saml? or Settings.overleaf?.oauth?
  5. hasFeature: (feature) ->
  6. switch feature
  7. when 'homepage'
  8. return Settings.enableHomepage
  9. when 'registration'
  10. return not Features.externalAuthenticationSystemUsed()
  11. when 'github-sync'
  12. return Settings.enableGithubSync
  13. when 'v1-return-message'
  14. return Settings.accountMerge? and Settings.overleaf?
  15. when 'rich-text'
  16. return Settings.showRichText
  17. when 'custom-togglers'
  18. return Settings.overleaf?
  19. else
  20. throw new Error("unknown feature: #{feature}")