Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

Users can only see users with the same email domain

Servinho Deve
Tera Contributor

Hello everyone!
I need to add logic to the Users table, so non-admin users can only see users with the same email domain

e.g:

user@example.com should only be able to see users that end in @Example.com

and otheruser@test.com can only see users that end in @test.com

 

Any idea? Thanks.

1 ACCEPTED SOLUTION

Sarika S Nair1
Kilo Sage

Hi @Servinho Deve 

create one advanced read ACL like below in user table.

 

var userEmail = gs.getUser().getEmail();
var domainIndex=userEmail.indexOf("@");
var emailDomain=userEmail.slice(domainIndex+1,userEmail.length());
if(current.email.indexOf(emailDomain)>=0){
answer = true;
}
else{
answer = false;
}

 

 

View solution in original post

1 REPLY 1

Sarika S Nair1
Kilo Sage

Hi @Servinho Deve 

create one advanced read ACL like below in user table.

 

var userEmail = gs.getUser().getEmail();
var domainIndex=userEmail.indexOf("@");
var emailDomain=userEmail.slice(domainIndex+1,userEmail.length());
if(current.email.indexOf(emailDomain)>=0){
answer = true;
}
else{
answer = false;
}