Skip to content

[PoC] Allow to uplod avatars via a public API - #20072

Closed
rullzer wants to merge 1 commit into
masterfrom
enh/ocs_avatar_api
Closed

[PoC] Allow to uplod avatars via a public API#20072
rullzer wants to merge 1 commit into
masterfrom
enh/ocs_avatar_api

Conversation

@rullzer

Copy link
Copy Markdown
Member

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

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>
@rullzerrullzer added this to the Nextcloud 19 milestone Mar 20, 2020
// TODO: Return link to avatar?
}

public function deleteAvatar(string $userId): DataResponse {

Copy link
Copy Markdown
Member

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) {

Copy link
Copy Markdown
Member

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) {

Copy link
Copy Markdown
Member

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

This was referenced Apr 4, 2020

$file = $this->request->getUploadedFile('avatar');

if ($file['size'] > 20 * 1024 * 1024) {

Copy link
Copy Markdown
Member

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?

Copy link
Copy Markdown
Member

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?

@MorrisJobkeMorrisJobke mentioned this pull request Aug 11, 2020
57 tasks
@rullzerrullzer closed this Nov 9, 2020
@skjnldsv
skjnldsv deleted the enh/ocs_avatar_api branch March 14, 2024 07:41
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. developingWork in progressenhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add "public" OCS endpoint to manage the avatar

3 participants

@rullzer@nickvergessen@skjnldsv