When trying to update current user i get this error "User has no permission to update entity 'Users'."

after user registration i add custom role to user
when I try to update user I get this error '“User has no permission to update entity ‘Users’.”
could u please help me @mark-piller

@mark-piller

      BackendlessUser? user = await Backendless.userService.getCurrentUser();
      user?.setProperty("FirstName", firstName);
      user?.setProperty("LastName", lastName);
      user?.setProperty("email", email);
      user?.setProperty("objectId", user.getObjectId());

      BackendlessUser? currentUser =
          await Backendless.userService.update(user!);

Hi @Tetris_Test ,

It seems that you have misconfigured permissions for one of the roles. I would suggest you to check our documentation about how security layer in Backendless works.

Regards, Andriy

i read it very well the user can’t update his name and email and he is the owner of this row
@Andriy_Konoz could u please help?

@Tetris_Test ,

What is your app ID and what is user ID of user which encountered this error?

appId :- 1B87CFC9-DC13-690E-FFA2-F557A5EF0E00
user id:- E0685E58-4DD4-4F06-B933-790A537DD592
but this happened with any use after having the the role I can get user but can’t update
@Andriy_Konoz

@mark-piller

@Tetris_Test ,

Have you explicitly logged in user after his registration?

yes i am login in with twilllio and OTP code
@Andriy_Konoz

@mark-piller

Hello, @Tetris_Test.

In the Users Found table Update on the Roles tab Permissions for the AuthenticatedUser role. And this layer, according to the documentation, takes precedence over the explicit permission for the owner in the OwnerPolicy.

Regards, Nikita.

Hi @Tetris_Test

I have tried to reproduce your issue.
Users with the custom role “student” will be allowed to update records, while users with the custom role “activeProf” will be denied the ability to update records.

Please note that I couldn’t find the user with the provided userId, so I am unsure of their assigned role.

Regards,
Viktor