mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 17:08:53 +00:00
update password reset check for user PATCH request (#238)
This commit is contained in:
parent
1e5a0f8f88
commit
14240cbabf
1 changed files with 3 additions and 6 deletions
|
|
@ -107,12 +107,6 @@ func validateModifyUserRequest(next endpoint.Endpoint) endpoint.Endpoint {
|
|||
badArgs = append(badArgs, invalidArgument{name: field, reason: "no write permissions on user"})
|
||||
}
|
||||
}
|
||||
if p.Password != nil {
|
||||
if !vc.IsUserID(uid) || !vc.IsAdmin() {
|
||||
badArgs = append(badArgs,
|
||||
invalidArgument{name: "password", reason: "must be an admin or own account"})
|
||||
}
|
||||
}
|
||||
if len(badArgs) != 0 {
|
||||
return nil, permissionError{badArgs: badArgs}
|
||||
}
|
||||
|
|
@ -151,6 +145,9 @@ func requireRoleForUserModification(p kolide.UserPayload) map[permission][]strin
|
|||
if p.Email != nil {
|
||||
selfFields = append(selfFields, "email")
|
||||
}
|
||||
if p.Password != nil {
|
||||
selfFields = append(selfFields, "password")
|
||||
}
|
||||
// self is always a must, otherwise
|
||||
// anyone can edit the field, and we don't have that requirement
|
||||
must[self] = selfFields
|
||||
|
|
|
|||
Loading…
Reference in a new issue