Merge pull request #1358 from clarkwinkelmann/avatar-permission

Assert permission when updating avatar
This commit is contained in:
Toby Zerner 2018-02-01 06:54:47 +10:30 committed by GitHub
commit 25154dabff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -147,6 +147,8 @@ class EditUserHandler
}
if ($avatarUrl = array_get($attributes, 'avatarUrl')) {
$this->assertPermission($canEdit);
$validation = $this->validatorFactory->make(compact('avatarUrl'), ['avatarUrl' => 'url']);
if ($validation->fails()) {
@ -161,6 +163,8 @@ class EditUserHandler
//
}
} elseif (array_key_exists('avatarUrl', $attributes)) {
$this->assertPermission($canEdit);
$this->avatarUploader->remove($user);
}