[MM-28533] [MM-28532] [MM-28531] Fixes several bugs with sysconsole_write_usermanagement (#15559)

* MM-28533 Fix incorrect permission check for reset password

* Allow write users to edit other users, promote and demote guests

* Update ancillary perms for PERMISSION_SYSCONSOLE_WRITE_USERMANAGEMENT_USER

* MM-28532

* Dont allow non sysadmin to update passwords / reset passwords / patch user on sysadmins

* MM-28532: Updates test.

* MM-28533: Merge fix.

* MM-28533: Adds ability for new roles to activate/deactivate non-system-admin users.

Co-authored-by: Martin Kraft <martin@upspin.org>
Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
Farhan Munshi
2020-10-07 19:41:46 -04:00
коммит произвёл GitHub
родитель 7f85991009
Коммит 6766853f8a
4 изменённых файлов: 84 добавлений и 4 удалений

Просмотреть файл

@@ -5611,6 +5611,16 @@ func (c *Client4) UploadData(uploadId string, data io.Reader) (*FileInfo, *Respo
return FileInfoFromJson(r.Body), BuildResponse(r)
}
func (c *Client4) UpdatePassword(userId, currentPassword, newPassword string) *Response {
requestBody := map[string]string{"current_password": currentPassword, "new_password": newPassword}
r, err := c.DoApiPut(c.GetUserRoute(userId)+"/password", MapToJson(requestBody))
if err != nil {
return BuildErrorResponse(r, err)
}
defer closeBody(r)
return BuildResponse(r)
}
// Cloud Section
func (c *Client4) GetCloudProducts() ([]*Product, *Response) {