I have a collection with a series of links to files to download. I want these files to be accessible only to users added in a reference field with PrivateMemebersData of this collection.
Collection =
Column 1 : (Title),
Column 2 : (Name of File),
Column 3 : (file),
Column 4 : (referenced from PrivateMembersData)
ROW 1
Field 1 : Tiltle_A
Field 2 : Name_A
Field 3 : Link_A
Field 4 : User [all]
ROW 2
Field 1 : Tiltle_B
Field 2 : Name_B
Field 3 : Link_B
Field 4 : User [many]
This page is accessible only by a registered user.
My code :
import wixUsers from ‘wix-users’ ;
import wixData from ‘wix-data’ ;
let user = wixUsers.currentUser
let userID = user.id
$w.onReady( function () {
//Get current user email address just to check if is ok
wixUsers.currentUser.getEmail()
.then( (email) => {
let userEmail = email;
console.log(userEmail)
//The user that i get it’s correct but i don’t know how to use as a filter
//Filter the dataset
$w( “#dataset1” ).setFilter(wixData.filter()
.contains( “user” , userID))
// .contains( “user” , email))
})
});
Thank you