Questions about how to handle user types and user data

Hi! I’m a Bubble Hobbist and I’m building an app to track projects in the line of work I’m in. I eventually want to have other users and perhaps make some income. Anyways…

I want to have 3 levels of users: Free, Basic, Pro where Free only has access to 3 pages, Basic has access to more pages and Pro has access to all pages.

I was trying to follow this post User Permission System - #2 by mikeloc
but was getting stuck here “Then create a flow on page load that checks if a user role is contained for that page’s name.” I don’t know how to do those kinds of workflows.

Also, does auto binding come into play when creating user types?
Each user will only see their own data so I don’t think I need to get into the privacy of the data types.
But should I do that if it’s easier / better? If so, how do I do that?

Also, how do I know what app data corresponds to which user? Should I create a User under all my data types that are associated with user data so they are linked? Or, should I create a List of Data Type under the User? Does that make sense?

I was watching this video but I don’t think its what I’m looking for User Roles & Permissions for Custom ERP App on Bubble (Video #3) - YouTube

If anyone has any suggestions, it would be super helpful!
Thanks

Hello,

It seems like you have quite a bit of “struggling” yet before you really grasp Bubble concepts, but if you put in the time to learn and read, you will manage. Keep reading and trying new things until you understand the information presented. Bubble is a powerful tool, but there is still a moderate learning curve in the beginning.

Nevertheless, I am going to present some information that will hopefully provide you with enough direction and encouragement to keep trying.

First, there are two topics. Auto binding/data privacy and app design with respect to user roles. As for the former, don’t concern yourself with those topics, later on you can figure out how to implement them in your app. Starting out, don’t use auto binding and remove all privacy restrictions on all data types (including the default that are set on user), they will just cause confusion.

As for the latter, I will explain now. First, you should plan to include a reference to “User” across any data type that is specific to a user in your application. It might not be need across all data types as some data types might be details of another or some data types might apply to any user.

For example, a company data type might have a reference to multiple addresses using an address data type. The address data type does not need a user reference so long as the company data type has the user reference (e.g. User → Company → Addresses).

As for creating the flow on page load that checks for role I have provided a visual example and an editor link below.

What you see happening is a Navigation → Go to page… (Action) on the Manager’s page using the event General-> Page is Loaded. When this event is triggered on the Manager’s page it is going to navigate the user to the index page (destination). However, this only runs when the current users role doesn’t contain “Manager” or “Admin”. The logic is inverted in this example, but if you had a page with an element that you only wanted a manager to see you could use similar logic inverted (e.g. when role contains “Manager” → show element, otherwise the element remains hidden).

The role is created as an option set and attached to the datatype as shown below:


Screenshot 2022-05-27 at 1.38.29 PM

The editor link to see it in action is here (you can review the administrator page for another example). Double-trouble-bubble | Bubble Editor

Note: In case you haven’t made it this far yet in Bubble, All users can be easily impersonated so that you can see the different roles in action by using the “run-as -->” link in the user list (shown below).

Thank you for your reply. I appreciate it.

I totally get what you’re saying. I didn’t think to put the user type check in the only when section. I guess I’ll need to add that to the certain header elements so the navigation is restricted as well and anywhere else that doesn’t pertain to certain levels of users.

Edit: I’ll prob need to add constraints to all my Do a search for… User = current user

Thanks again!

This topic was automatically closed after 70 days. New replies are no longer allowed.