How to Structure Two Different User Roles + Admin

Hello everyone,

I’m a front-end developer / designer who is new to Bubble. I’m extremely excited by the possibilities it creates for me! I’m creating a simple user role structure for my app and would love to know if I’m headed in the right direction. Several people have posted on the forums about similar setups, but their questions have been different enough that I’m not sure they solve my problem.

I want to have three user roles, one of which is an admin.

The main role is a volunteer. They can manage their own profile and search and join events from a dashboard.

The other role is also a volunteer, but they have clicked on something on the dashboard (like a “become an organization” button) and have requested to represent an organization. This role is then allowed to see an organization dashboard that lets them post on behalf of the organization and manage its profile.

So my main question is – does this seem like a reasonable setup? And would I go about separating these roles via a new “role” field in the user table? I had initially thought to create volunteers and organizations as separate roles altogether, but I’d like for users associated with an organization to also be able to volunteer. Do I need to mess with the “privacy” tab (I honestly don’t quite yet understand the privacy tab)?

Thank you in advance, and I’m excited to join this community!

1 Like

I literally have the same setup with one of my apps. After a ton of confusion, testing, and headaches, here’s the best way to go about this:

Both “Volunteers” and “Organizations” have the abilities of “Volunteers”. This means the User Database Table that Bubble automatically provides should act as the “Volunteers” table.

Now, for “Organizations”, you want to create a separate table. One of the fields in this table will be “User” that has a data type of a User (essentially a volunteer).

This way, User’s that have an Organization attached will be able to have new data fields and be allowed to do different things compared to the regular User.

Lastly, for admin, you can either do the same approach used for Organization OR create a yes/no field in the User table called “admin”. It should automatically be set as ‘false’ when a user signs up. If you sign up and are an admin, just head over to the database, find your user, and change the admin field from ‘false’ to ‘true’.

Hope this all makes sense,
Daniel

2 Likes

Thanks so much for the detailed response! This makes a lot of sense, especially with how to define the organization. Glad I’m not completely off-base :smile:

So when I show/hide data on the dashboard based on organization attachment, I’d condition the data to show by looking up the current user on the organization table’s user field, not by searching the user table for an organization field?

Thanks again!

1 Like

Yes, so in the conditionals, I’d do something like:

if search for organizations (User = current user) is not 0, then make this element visible. Obviously, the elements that will become visible should be hidden when the page is loaded.

1 Like

Perfect! And really, thanks again for the quick and detailed response. This is really fun to learn and play with.

1 Like

No problem. Hit me up anytime.

1 Like

@dbevan - Sorry to reply to an old thread, but I’m in this situation and I’ve read through many posts in the forum on this and I’m still not getting the correct result. I have 4 user types so I’m not using yes/no. I think it is because I am not doing “search for”
If I created a “user_role” field on the user and made this user an “admin” (currently text in the user role field) does it work to say make visible if "current user’s user_role is “admin” or do I have to use the “do a search for” function? If so, what is the right syntax?