mirror of
https://github.com/navidrome/navidrome.git
synced 2026-11-09 11:48:41 +01:00
Add EnableUserEditing, to control whether a regular user can change their own details (default true)
This commit is contained in:
parent
2ff1c79b64
commit
7feda4bea4
6 changed files with 22 additions and 0 deletions
|
|
@ -4,6 +4,8 @@ import (
|
|||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/navidrome/navidrome/conf"
|
||||
|
||||
. "github.com/Masterminds/squirrel"
|
||||
"github.com/astaxie/beego/orm"
|
||||
"github.com/deluan/rest"
|
||||
|
|
@ -145,6 +147,9 @@ func (r *userRepository) Update(entity interface{}, cols ...string) error {
|
|||
return rest.ErrPermissionDenied
|
||||
}
|
||||
if !usr.IsAdmin {
|
||||
if !conf.Server.EnableUserEditing {
|
||||
return rest.ErrPermissionDenied
|
||||
}
|
||||
u.IsAdmin = false
|
||||
u.UserName = usr.UserName
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue