From b0749b5595fda2ad23194b79a006cad0498ddff3 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Fri, 29 Jan 2021 12:59:12 +0100 Subject: [PATCH] :sparkles: Add option for disable demo users. --- backend/src/app/rpc/mutations/demo.clj | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/backend/src/app/rpc/mutations/demo.clj b/backend/src/app/rpc/mutations/demo.clj index 884876d37..5ebe0b5cf 100644 --- a/backend/src/app/rpc/mutations/demo.clj +++ b/backend/src/app/rpc/mutations/demo.clj @@ -11,6 +11,7 @@ "A demo specific mutations." (:require [app.common.uuid :as uuid] + [app.common.exceptions :as ex] [app.config :as cfg] [app.db :as db] [app.rpc.mutations.profile :as profile] @@ -36,6 +37,12 @@ :fullname fullname :demo? true :password password}] + + (when-not (:allow-demo-users cfg/config) + (ex/raise :type :validation + :code :demo-users-not-allowed + :hint "Demo users are disabled by config.")) + (db/with-atomic [conn pool] (->> (#'profile/create-profile conn params) (#'profile/create-profile-relations conn))