File tree Expand file tree Collapse file tree 3 files changed +15
-9
lines changed
Expand file tree Collapse file tree 3 files changed +15
-9
lines changed Original file line number Diff line number Diff line change 1515package controllers
1616
1717import (
18+ "github.com/beego/beego"
1819 "github.com/casibase/casibase/object"
1920 "github.com/casibase/casibase/util"
2021)
@@ -80,15 +81,20 @@ func (c *ApiController) GetRangeUsages() {
8081// @router /get-users [get]
8182func (c * ApiController ) GetUsers () {
8283 user := c .Input ().Get ("user" )
83- if c .IsAdmin () {
84+ disablePreviewMode , _ := beego .AppConfig .Bool ("disablePreviewMode" )
85+ var users []string
86+ var err error
87+ isAdmin := c .IsAdmin ()
88+ if isAdmin || ! disablePreviewMode {
8489 user = ""
90+ users , err = object .GetUsers (user )
91+ if err != nil {
92+ c .ResponseError (err .Error ())
93+ return
94+ }
95+ } else {
96+ users = append (users , user )
8597 }
86- users , err := object .GetUsers (user )
87- if err != nil {
88- c .ResponseError (err .Error ())
89- return
90- }
91-
9298 c .ResponseOk (users )
9399}
94100
Original file line number Diff line number Diff line change @@ -257,7 +257,7 @@ class ActivityPage extends BaseListPage {
257257
258258 renderDropdown ( ) {
259259 const users_options = [
260- < option key = "all" value = "All" disabled = { ! ( this . props . account . name === "admin" || this . props . account . type === "chat-admin" ) } >
260+ < option key = "all" value = "All" disabled = { ! Setting . isLocalAdminUser ( this . props . account ) } >
261261 All
262262 </ option > ,
263263 ...this . state . users . map ( ( user , index ) => (
Original file line number Diff line number Diff line change @@ -441,7 +441,7 @@ class UsagePage extends BaseListPage {
441441
442442 renderDropdown ( ) {
443443 const users_options = [
444- < option key = "all" value = "All" disabled = { ! ( this . props . account . name === "admin" || this . props . account . type === "chat-admin" ) } >
444+ < option key = "all" value = "All" disabled = { ! Setting . isLocalAdminUser ( this . props . account ) } >
445445 All
446446 </ option > ,
447447 ...this . state . users . map ( ( user , index ) => (
You can’t perform that action at this time.
0 commit comments