Prechádzať zdrojové kódy

Added env var to disable project creation filtering

jnfrati 4 rokov pred
rodič
commit
2a0f05bdad

+ 6 - 1
api/server/handlers/user/can_create_project.go

@@ -27,6 +27,11 @@ func NewCanCreateProjectHandler(
 }
 
 func (c *CanCreateProject) ServeHTTP(w http.ResponseWriter, r *http.Request) {
+	if c.Config().ServerConf.DisableAllowlist {
+		c.WriteResult(w, r, "")
+		return
+	}
+
 	user, _ := r.Context().Value(types.UserScope).(*models.User)
 
 	exists, err := c.Repo().Allowlist().UserEmailExists(user.Email)
@@ -43,5 +48,5 @@ func (c *CanCreateProject) ServeHTTP(w http.ResponseWriter, r *http.Request) {
 		return
 	}
 
-	c.WriteResult(w, r, user.ToUserType())
+	c.WriteResult(w, r, "")
 }

+ 3 - 0
api/server/shared/config/env/envconfs.go

@@ -88,6 +88,9 @@ type ServerConf struct {
 
 	// Enable pprof profiling endpoints
 	PprofEnabled bool `env:"PPROF_ENABLED,default=false"`
+
+	// Disable filtering for project creation
+	DisableAllowlist bool `env:"DISABLE_ALLOWLIST,default=false"`
 }
 
 // DBConf is the database configuration: if generated from environment variables,