Jelajahi Sumber

Add missed Features.coffee

James Allen 9 tahun lalu
induk
melakukan
a97c3ba580
1 mengubah file dengan 12 tambahan dan 0 penghapusan
  1. 12 0
      services/web/app/coffee/infrastructure/Features.coffee

+ 12 - 0
services/web/app/coffee/infrastructure/Features.coffee

@@ -0,0 +1,12 @@
+Settings = require 'settings-sharelatex'
+
+module.exports = Features =
+	externalAuthenticationSystemUsed: ->
+		Settings.ldap? or Settings.saml? or Settings.overleaf?.oauth?
+
+	hasFeature: (feature) ->
+		switch feature
+			when 'registration'
+				return not Features.externalAuthenticationSystemUsed()
+			else
+				throw new Error("unknown feature: #{feature}")