mirror of
https://github.com/navidrome/navidrome.git
synced 2026-11-19 15:23:36 +00:00
Add EnableUserEditing, to control whether a regular user can change their own details (default true)
This commit is contained in:
1 parent
2ff1c79b64
commit
7feda4bea4
6 files changed
+22
No files matched your search
@@ -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
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user