How to display user details and define privacy role to make user email not visible

Hey,
I would like to define my database privacy roles so that no one could see or access app’s user email.
in this app users are able to write posts and their posts are displayed on a repeating group getting their Name and Surname from Post’s creator (which is basically an email). So, if I define a privacy role that no one could view field “created by” I would not be able to extract users details from there.
I thought of some alternatives: a)I could do a search on User database and associate it through Users uniqueID when displaying information about user. (which in my experience, having elements on repeating group with search function slows down the loading speed of repeating group)
b) when creating a Post thing in workflow straight away set the fields for Name and Surname (which is not a great solution as if the user decides to modify its details the post fields would remain unchanged)
Any thoughts? Thanks!

Privacy roles can be defined either as “all-or-nothing” or you can make them granular (ie. provide access to some fields - like username/first name - and not provide access to others - like email).

You can control this by first defining a privacy role for the common user and then unchecking the “View all fields” box, then checking/unchecking as appropriate.

If you’re looking to familiarize yourself more with privacy roles, I have a lesson on my Youtube channel.

One thing to keep in mind: privacy roles are enforced for each table. So, the field “email” exists on the user table. If you want to build a privacy role that limits visibility of email, then you’d define it on the user table. But if you wanted to limit visibility about a post’s details, then you’d define that on the posts table.

I watched your video and it is great! I still have kinda same question though. If I define all the privacy roles not to show user email to anyone and nowhere. How do I display users other details such as name, last name… if it is only identifiable by the email. :thinking:

Email is one of many fields you may have in the User data type. Even though the User may log-in using an email address as a unique identifier, that is not the unique identifier itself. (A User has a “unique ID” field just like any other object in Bubble’s database.)

So you can control privacy of the email address itself INDEPENDENTLY of other User attributes such a First Name, Last Name, etc. It just works.

when user creates a thing in any data type it’s email is printed into “Created by” field automatically. So, if I define a privacy rule for ‘‘Created by’’ field not to be shown to anyone, I can’t identify the user.
I see one option though when user creates a thing capture it’s uniqueID and print on the thing’s field and then when I need to display user’s name I do a search on user type that matches that ID.
(just it isn’t so eficient)

Created by is a relational value (ie. a unique ID that links to that user’s record: all of the details of a given user - their email, along with any other fields you create: first name, profile image, etc.

If you want to control visibility of the email, you define that on the User table (where the field for email exists). You wouldn’t define this on each individual table where Created by exists.

1 Like