wix-router: WixRouterUser role 'siteOwner'???

According to the wix users and router documentation these are the core roles that expected in the user role property:

role

Gets the user’s role.
Syntax
Description
Gets one of the following roles:

  • “Admin” — The owner of the site.

  • “Member” — A user who is logged in.

  • “Visitor” — A user who is not logged in.
    I am trying to use the wix-router for an admin authenticated set of pages. In my testing the test

if (request.user.role === ‘Admin’) {

}

kept failing so I created a ‘sendStatus’ page to display the role being retrieved and it turns out that one of the roles the user returns is also ‘siteOwner’.

Is this intended or is this a bug?

Either way the bug needs to be resolved OR the api docs need to be updated :wink:

Thanks for your input,
I will get this issue to the relevant people.

Hi Omer/Shlomi:

Here’s another piece of information.

wix-router has yet another role that I encountered while trying to debug a role based router.

Apparently there is also an “anonymous” role with an “undefined” id. This seems to be the user role info that the router uses where a front page would use Visitor. So essentially a routed page accessed by a visitor who is not logged in. Shouldn’t this be “Visitor”?

Also what should I expect from wix-users role settings if I start to make use of CRM roles? Do these get ignored or will I expect that there will be a CRM API capability to grab the user role (and other) info???

Hi,

Thanks for your good input, seems you have a point. We will further look into it and keep you posted!

Thanks,
Shlomi

Hi Shlomi: I had a good chat with Ben, Tom and Alon yesterday and they told me about some planned fixes to address this with an updated crm capability and the new wix-users getRoles() function.

Cheers
Steve

Hi stcroppe,
Following your post we fixed the router user roles!
You can now use the new API which is similar to the wix-users role API:

  • “Admin” — The owner of the site.

  • “Member” — A user who is logged in.

  • “Visitor” — A user who is not logged in.
    Thanks for your important input,
    San