Restrict result fields based on user permissions?

Given this scenario:

  • an index of people where we include first name, last name and email for each person
  • admin users who should be able to search on any of those fields. Results should include all three values.
  • regular users can also do searches. However for privacy reasons, we don’t want to expose full emails. So, results should either exclude the email field value or (preferably) mask the email field value.

How can this be accomplished?

1 Like