If-Query To Check If The Member Has The Permission To The Database.

Hi everyone !
How are you ( everyone ) ?
I have one issue (question) based on my code of my website. I want to show a button in the repeater, but I have figured out that using foreach item. But the problem arises when I don’t know how to use the if-query to check if the member has the permission to the database.

Thanks,
Ajith

Hello again,

i think that what you are searching for is some king of a “Role-System” where every user has his own role. Wix does already offer this option.

https://www.wix.com/corvid/reference/wix-router/wixrouteruser/role

import wixUsers from 'wix-users';
2
3// ...
4
5let user = wixUsers.currentUser;
6
7let userId = user.id;           // "r5cme-6fem-485j-djre-4844c49"
8let isLoggedIn = user.loggedIn; // true
9
10user.getEmail()
11  .then( (email) => {
12    let userEmail = email;      // "user@something.com"
13  } );
14
15user.getRoles()
16  .then( (roles) => {
17    let firstRole = roles[0];
18    let roleName = firstRole.name;                // "Role Name"
19    let roleDescription = firstRole.description;  // "Role Description"
20  } );
21
22user.getPricingPlans()
23  .then( (pricingPlans) => {
24    let firstPlan = pricingPlans[0];
25    let planName = firstPlan.name;          // "Gold"
26    let startDate = firstPlan.startDate;    // Wed Aug 29 2018 09:39:41 GMT-0500 (Eastern Standard Time)
27    let expiryDate = firstPlan.expiryDate;  // Thu Nov 29 2018 08:39:41 GMT-0400 (Eastern Daylight Time)
28  } );