I have a problem with auto editing user account.
In a service, I have this piece of code that changes the current user’s account.
$user = $this->repository->getCurrentUser(); $userContent = $contentService->loadContentByContentInfo($user->contentInfo); $draft = $contentService->createContentDraft($userContent->contentInfo); $struct = $contentService->newContentUpdateStruct(); $struct->setField('my_field', $my_new_value); $contentService->updateContent($draft->versionInfo, $struct); $contentService->publishVersion($draft->versionInfo);
And in response I have the following error 500:
User does not have access to ‘edit’ ‘content’ with: contentId '11290’
500 Internal Server Error - UnauthorizedException
However, my user has the right to “user/selfedit”.
On the other hand I do not see how to give him the right of edition on the contents of type user but only himself.
By the way, I would like to skip the rights management at the service level…