Forum Academy Marketplace Showcase Pricing Features

Relationship Users / Project / Role

Hello,

I Have 2 data types: users and projects.

I want to add users to a project and specify his role within the project.

I created a type “ProjectRole” that includes field: role(text) and project(type project).
I managed to create workflows to add users with the right role. But I am stuck at the problem of creating the list of users that belongs to the project (team members).
In a Project’s Page, I created a repeating group that contains “Users”. But once I want to perform a search I find my problem.
I was expecting to make a search of Users with the field “Projects” (that is a “ProjectRole” type) in which the field Project matches the current’s page Project. But seems there is no way to generate this sentence with the dynamic composer (see picture attached).
Where am I wrong?

Thanks!

Sergio

I think you are definitely on the right track. :slight_smile: Here’s one way to set this up:

Data Types (in bold):
Project Role
Fields
Role Title: (Type: Text, List: No)
Assigned Project: (Type: Project, List: No)
User: (Type: User, List: No)

Project
Fields
Name of Project: (Type: Text, List: No)
Team Members: (Type: Project Role, List: Yes)

User
Field to add
Roles (Type: Project Role, List: Yes) (This could display all of the projects a User is a part of and the associated roles that the User has)
*You could also have a field for Projects (Type: Projects, List: Yes), but the Roles field will contain the User’s Projects’ information as well.

Then when you have a page which is displaying a Project, your repeating group’s type of content could be Project Role (in order to display Users), and the data source could be: Current Page Project’s Project Roles.
If you wanted to have the cells display the Users that are part of the Project, you could have a text element containing the dynamic data “Current Cell Project Role’s User’s Name, Current Cell Project Role’s Role Title”. So each cell would display something like: “Sergio, Product Manager” (and then add more such as Profile Picture, or even a button to view that Team Member’s profile). As long as this page’s type of content is Project and the data source is Current Page’s Project, this should work as expected!

2 Likes

Faye,

Thanks. I see your point. Like that I an explicitly creating a relation table. I thought in bubble it was not necessary because you can create field of a custom type directly inside a table/type.
Said so, when I want to create a new relationship (assign user to project) I only need to add data to the project role table(create new thing project role) and insert the user, the role and the project. While the team field in the project table will be automatically linked?

I ll Rey it tonight and let you know.
Meanwhile thanks a lot for the prompt help.

Sergio

No problem at all :slight_smile: If you were to assign a User to a Project (after completing the inputs containing their Role Title, and selecting the User, from a searchbox for example), your workflow could be:

When Button Create Team Member is clicked --> 3 actions in the workflow:
1st action (Create the Project Role):
Data: Create a New Thing --> Thing: Project Role --> Fields to Change: Role Title = Input Role Title’s value, User = Searchbox User’s value.

2nd action (Add the Project Role to the Project’s List of Team Members):
Data: Make Changes to A Thing --> Thing to Change: Current Page Project --> Fields to Change: Team Members add (Result of Step 1 (create a new Project Role)).

3rd action (Add the Project Role to the User’s List of Roles):
Data: Make Changes to A Thing --> Thing to Change: Searchbox User’s value --> Fields to Change: Roles add (Result of Step 1 (create a new Project Role)).

The other way to query this data (instead of storing it within three data types) would be to Do A Search For in repeating groups and adding constraints to the search. But I think it will make querying things easier as your application becomes more complex to have the data structured in this way. Completely up to you of course.

Hi,

so it works nicely but… I have the same sintax limitation problem now in the definiton of the data type privacy (see picture).
I would like to give access right only to the team member of course. I cannot input in the field “when” the sentence: Current User’s Roles’s Project…

1 Like

Ohh you’re right; it is different there - my apologies. I think the way to do it would be to have a List of Projects within the User Data Type after all, so you could have the statement:

Agreed, that is what I was using previously.

Focusing on this issue now (the definition of the data type privacy ), this syntax limitation create some trouble to me.

  • I would like to give some different access rights (e.g. the user with the role “Project Manager” ) within a specific project.

  • In general I would like to give some write/access right to specific user of my application (e.g. user with a field usertype=“Admin”)

I wonder if this is a limitation of bubble or just the way I see the data type privacy is wrong…

I don’t think you’re thinking about this wrong. @romanmg could you double-check if I’m missing something regarding this data structure and data privacy? Or any suggestions about how to set this up in a better way?

If you’d like certain elements and content to only be visible to a Project Manager (for example), that can definitely be achieved by setting elements to not be visible on page load, and then creating conditional statements which make those application features/functionality visible when the Current User’s Project Role meets the requirements you set. You can also set up conditions on the workflows to ensure only they will only occur when the Current User’s Role meets the requirements for those specific workflows to run. So the functionality you need is definitely possible within the UI editor; I’m just not sure about the best way to set up the Data Privacy roles for this as well.

Thanks,

I am working on the UI side fo the different roles. While I created a yes/no field in the user called “is Admin”. Then I can create the proper condition in privacy “when current user’s is Admin is yes”!

Thanks again!

1 Like

Great! No problem at all! :slight_smile:
*If anyone has any suggestions regarding this data structure/data privacy roles please still add to this thread.

Taking a look! Hey, @sergio.rufini, could you share a link so I can look at some of the data privacy options available with your current structure?

1 Like

Hi Roman,

thanks for the help!
I have the app set a private, as far as I understood it does not work sharing the link.
Anyway, these screenshots should be have all the info

Hey again Sergio :slight_smile: I think that if each Project will only really have two different major roles of Users (Managers or Team Members) - and you want to ensure that Users who are accessing any information on the Project are within one of those lists - you can set the fields up within the Project data type in this way:

Managers (Type: User, List: Yes)
Team Members (Type: User, List: Yes)

Then you can set up data privacy roles such as “When Project’s Team contains Current User” “When Project’s Managers contains Current User”, and adjust their permissions accordingly. Ultimately, everyone who’s part of the project will be included as either a Manager or a Team Member. You can still keep the Project Role data type for more flexibility regarding each User’s specific Role Title, but this way you can ensure that only Managers or Team Members can view/find the Projects they belong to.

Hey guys so sorry about my delay here. I asked for more info and then I got stuck on mobile for the rest of the day.

I think @fayewatson’s most recent solution is a very, very clean one. Even if you need more than 2 roles (that are user lists), it would still keep everything very defined and separated and allow you to create clear privacy roles.

I also think it’s worth putting in more effort to create a solid privacy system, so if it means creating more fields and defining more roles, then do it. I’d much rather have a rock-solid permissions system that is carefully spelled out than less fields that might leave room for holes.


Gaby | Coaching Bubble

1 Like