[management] restrict dashboard only to restrictable roles

This commit is contained in:
Pedro Costa
2025-04-16 19:34:20 +01:00
parent 974f297022
commit ab391ed9fa
8 changed files with 156 additions and 22 deletions

View File

@@ -286,11 +286,11 @@ func (h *handler) getCurrentUser(w http.ResponseWriter, r *http.Request) {
func toUserWithPermissionsResponse(user *users.UserInfoWithPermissions, userID string) *api.User {
response := toUserResponse(user.UserInfo, userID)
if user.Permissions == nil {
return response
permissions := api.UserPermissions{
IsRestricted: user.Restricted,
}
permissions := &api.UserPermissions{}
if len(user.Permissions.AutoAllowNew) > 0 {
permissions.Default = make(map[string]bool)
for k, v := range user.Permissions.AutoAllowNew {