From d32a31f4b682b172bac7ce9d15924b50242e20e0 Mon Sep 17 00:00:00 2001 From: Denis Gukov Date: Sun, 27 Aug 2023 15:00:54 +0200 Subject: [PATCH] feat: remove demo mode --- api/auth.go | 11 +---------- api/router.go | 1 - util/config.go | 1 - web/src/App.vue | 11 ----------- 4 files changed, 1 insertion(+), 23 deletions(-) diff --git a/api/auth.go b/api/auth.go index e7a42731f..c0f44f192 100644 --- a/api/auth.go +++ b/api/auth.go @@ -61,7 +61,7 @@ func authenticationHandler(w http.ResponseWriter, r *http.Request) bool { return false } - if time.Since(session.LastActive).Hours() > 7*24 && !util.Config.DemoMode { + if time.Since(session.LastActive).Hours() > 7*24 { // more than week old unused session // destroy. if err := helpers.Store(r).ExpireSession(userID, sessionID); err != nil { @@ -90,15 +90,6 @@ func authenticationHandler(w http.ResponseWriter, r *http.Request) bool { return false } - if util.Config.DemoMode { - if !user.Admin && r.Method != "GET" && - !strings.HasSuffix(r.URL.Path, "/tasks") && - !strings.HasSuffix(r.URL.Path, "/stop") { - w.WriteHeader(http.StatusUnauthorized) - return false - } - } - context.Set(r, "user", &user) return true } diff --git a/api/router.go b/api/router.go index 0cfb5eafc..dbae5099c 100644 --- a/api/router.go +++ b/api/router.go @@ -370,7 +370,6 @@ func getSystemInfo(w http.ResponseWriter, r *http.Request) { body := map[string]interface{}{ "version": util.Version, "ansible": util.AnsibleVersion(), - "demo": util.Config.DemoMode, } helpers.WriteJSON(w, http.StatusOK, body) diff --git a/util/config.go b/util/config.go index 3946e2f47..2634445d1 100644 --- a/util/config.go +++ b/util/config.go @@ -151,7 +151,6 @@ type ConfigType struct { MaxParallelTasks int `json:"max_parallel_tasks"` // feature switches - DemoMode bool `json:"demo_mode"` // Deprecated, will be deleted soon PasswordLoginDisable bool `json:"password_login_disable"` NonAdminCanCreateProject bool `json:"non_admin_can_create_project"` } diff --git a/web/src/App.vue b/web/src/App.vue index a4b23904d..cd503533a 100644 --- a/web/src/App.vue +++ b/web/src/App.vue @@ -188,17 +188,6 @@ - - - -
{{ $t('demoMode') }}
-
    -
  • {{ $t('youCanRunAnyTasks') }}
  • -
  • {{ $t('youHaveReadonlyAccess') }}
  • -
-
-
-