userpage: show placeholder message card for admins

This commit is contained in:
Harvey Tindall
2023-06-21 11:26:59 +01:00
parent cc4a97db28
commit e7f7dcbb78
5 changed files with 40 additions and 11 deletions

View File

@@ -28,6 +28,14 @@ func (app *appContext) MyDetails(gc *gin.Context) {
}
resp.Username = user.Name
resp.Admin = user.Policy.IsAdministrator
resp.AccountsAdmin = false
if !app.config.Section("ui").Key("allow_all").MustBool(false) {
adminOnly := app.config.Section("ui").Key("admin_only").MustBool(true)
if emailStore, ok := app.storage.GetEmailsKey(resp.Id); ok {
resp.AccountsAdmin = emailStore.Admin
}
resp.AccountsAdmin = resp.AccountsAdmin || (adminOnly && resp.Admin)
}
resp.Disabled = user.Policy.IsDisabled
if exp, ok := app.storage.users[user.ID]; ok {