-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PoC] Allow to uplod avatars via a public API #20072
Conversation
Fixes #10549 * Avatar must be sqaure * POST must be done using a mutlipart form * Key is avatar Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
// TODO: Return link to avatar? | ||
} | ||
|
||
public function deleteAvatar(string $userId): DataResponse { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@NoAdminRequired
$currentLoggedInUser = $this->userSession->getUser(); | ||
|
||
$targetUser = $this->userManager->get($userId); | ||
if ($targetUser === null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be needed as you have to be logged in?
$currentLoggedInUser = $this->userSession->getUser(); | ||
|
||
$targetUser = $this->userManager->get($userId); | ||
if ($targetUser === null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see comments from above method
|
||
$file = $this->request->getUploadedFile('avatar'); | ||
|
||
if ($file['size'] > 20 * 1024 * 1024) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would love to have this as a const somewhere :)
* @NoAdminRequired | ||
*/ | ||
public function getAvatar(string $userId): DataResponse { | ||
// TODO: Return link to avatar? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes! Cleaner :)
Optional parameter with size?
Fixes #10549
Signed-off-by: Roeland Jago Douma roeland@famdouma.nl