Updating User Property (without login) from API. PHP SDK

I have this bit of code in a controller.
$user = Backendless::$Persistence->of( 'Users ')->findById( $Id );
$user->setName(‘New Name’);
Backendless::$UserService->update( $user );
which is supposed to update the user’s name (or any other attribute). The user instance is returned properly and the new name set, but when I try to do the update. I get:
BackendlessException in UserService.php line 74: User not logged in or wrong user id
I am aware the documentation says the user must be logged in to update its attributes but I also read in a blog post that a user may be updated if the objectId is known, so my question is, is this possible? is there any workaround?
The reason for this, is that I need an administrator to be able to update certain properties.

I’ve tried updating using the objectId, but I get the same result… User not logged in or wrong user id
So how can I update without doing a login any user using php?

Hi Alejandro

An administrator should be also an existing and logged in user.
Just login under administrator account and execute the code, you mentioned, modifying another users information, according to the Administrator role permissions

Hmm, I don’t seem to have an administrator role?? Or how do I make a user one?

I’m not sure what permissions and where I should set, I’ve tried some but no difference…

Or should this even work in PHP without any login?

	$updateuser = new BackendlessUser();
	$updateuser->setProperty("objectId", xxxx");
 	$updateuser->setProperty('facebook_id', "yyyy");
	$updated_user = Backendless::$UserService->update($updateuser);

“Should it work” or “Should not” is totally up to you.

You have an instrument Security Roles and Permissions where you can configure wanted behaviour

According to your use case, you have several options:

  1. Give a NonAuthenticatedUser role, permissions to update stored data. This is absolutely not recommended option, because anyone can change your data now

  2. Create a specific Administrator user and give him Data Update permissions

  3. Create a new Administrator role with permissions to Data Update and assign this role to one or more users. Then, these users, after login will be able to modify another user’s properties