getUserRoles doesn't return all roles

Hello!
I have a problem with the js function Backendless.UserService.getUserRoles().

First of all I’m using the free subscription, and I’ve created a role called “management”

Here the problem:
1- User user@domain.com is configured with my own role “management”
2 - If I go to Data Management, system data section and Users, when I select the user and review the roles, the role “management” is selected.
3 - In my app, when I fetch the roles attached to the user using Backendless.UserService.getUserRoles() I only get “AuthenticadedUser” and “JSUser”.
Where is my own role “management”?

Anyone have a clue??

Thanks in advance!

Hey @Benet_Joan_Darder

Perhaps role has been assigned to the user AFTER he was logged in. In this case users’ roles will be updated only after re-login. If so - this is a known issue, it’s already fixed and will be released to cloud servers this week. If not - please provide the following details:

  • application ID;
  • steps how to reproduce the problem in details with a new user, f.e. usertest@domain.com (including when and how role has been set to a user)

Anton

Hello @anton-govorushkin,
Thanks for you reply.

After the role assignation, I performed a user log out, but when I made the login again, I only got the “authenticatedUser”, “JSUser”. My own role doesn’t appears.

This is my App-ID: 589551CD-9F56-C87C-FF40-4502E627CE00

User: bjdarder@uoc.edu

steps:

  • Create user
  • Login
  • Go to the Backendless Data Management screen and System Data section and select Users.
  • Select the user and assign the Role “Directiva” (directiva is the real name of the role)
  • Go to the app and perform a logout
  • Log in again and try to fetch the roles
  • Here is the problem, I only got “authenticatedUser” and “JSUser” but the assigned role “directiva” is not present.

Thanks!

Yes, this is a known problem and the fix will released this week. For referencing purposes ticket ID is BKNDLSS-19927

Anton

Perfect! thank you.

Waiting :slight_smile: