Skip to content

Commit

Permalink
Merge pull request #1443 from fiftin/remove_demo_mode
Browse files Browse the repository at this point in the history
feat: remove demo mode
  • Loading branch information
fiftin authored Aug 27, 2023
2 parents 36570ae + d32a31f commit bb4a9d9
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 23 deletions.
11 changes: 1 addition & 10 deletions api/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
Expand Down
1 change: 0 additions & 1 deletion api/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion util/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Expand Down
11 changes: 0 additions & 11 deletions web/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -188,17 +188,6 @@
</v-list>

<v-list class="pt-0" v-if="project">
<v-list-item v-if="systemInfo && systemInfo.demo">
<v-list-item-content>
<v-alert class="ma-0 pa-2" color="red">
<div class="mb-1 font-weight-bold">{{ $t('demoMode') }}</div>
<ul style="padding-left: 14px; font-size: 14px; line-height: 1.3;">
<li>{{ $t('youCanRunAnyTasks') }}</li>
<li>{{ $t('youHaveReadonlyAccess') }}</li>
</ul>
</v-alert>
</v-list-item-content>
</v-list-item>

<v-list-item key="dashboard" :to="`/project/${projectId}/history`">
<v-list-item-icon>
Expand Down

0 comments on commit bb4a9d9

Please sign in to comment.