'Admin' can no longer be accessed by getRoles?

‘Admin’ can no longer be accessed by getRoles?

I have some code that I use to check permissions of users and see if they’re able to see some buttons. It used to work for months, now it doesnt anymore.

user.getRoles()
  .then( (roles) => {
    //console.log("check roles here: " + roles)
    if(roles.length > 0) {
        let firstRole = roles[0];
        let checkRole = firstRole.name;
          console.log("Role is " + checkRole);
        if (checkRole === 'SALES' || checkRole === 'Admin'){
            //console.log("checkRole is " + checkRole);
            $w("#buttonCompMonitoring").expand();       
            //$w("#requestToair").expand();
        } 

Any insights?

Following

What do you get as RESULT for → roles

console.log(roles)

You are logged in as Admin?

Perhaps you are right. It’s something strange!
Logged-in as → ADMIN on my Login-System, ADMIN no longer existing in the results…


I am quite sure, i had yesterday 2-results when logged-in as ADMIN.

https://russian-dima.wixsite.com/login-system

I catch an error after that block

else {
      console.log("no roles");
            }
        } )
    .catch( (error) => {
    console.log(error);

and it displays “no roles”… so yeah length is 0

Do a test.
Add a new role to your ADMIN.

Log-in again. → now you get the new role?

If not → perhaps something wrong with your set-up?

I have a similar setup on my site and checked my page as soon as I saw this post, and the same “missing Admin” problem happens for me :frowning:
Hopefully someone from Wix can look into it as a bug and/or provide a fix

Yesterday it was working… → Now it is clear…

Then also another problem will be related to this one…

Just opened a ticket with Wix Support, explained the problem, and it was sent to their developers. Hopefully we’ll get a resolution.

same issue. Following.

@lmeyer Can you send me the ticket # so I can follow up internally? Thanks.

Looks like they fixed the issue, my site’s buttons are working again as they should

I can CONFIRM → ADMIN is back …

BEFORE…

AFTER…

Well done Wix/Velo-Team!

(Miss M. good job) :blossom: