FORUM COMMUNITY IDEAS SHOWCASE LEARNING CENTER

Multiple users viewing/editing the same data


#1

Hi there, Bubble community…

I am new to Bubble, and I’ve been having a crazy good time playing around with it and learning what it can do. That being said, I am a little frustrated right now because I can’t get what seems like a simple and prevalent use case to work after days of troubleshooting it myself and reading everything I could find out here.

Long story short… user A creates a “thing” that s/he can obviously view/edit. I want one or more other users (users B and C, for example) to be able to view/edit that “thing,” too, while one or more other users (users D and E, for example) can’t see that “thing” at all.

My thought was to create a collaborator field in the User table (with a type of list) and give user A a place where s/he can add collaborators by entering their email addresses (thus making a connection between user A’s email address and the collaborators’ email addresses). Then, I would simply go to the “thing” area in the Data Privacy section and construct the following condition: when this thing’s creator’s collaborator is current user.

So, again, it seems pretty simple (although, admittedly, I could be way off base with how I am approaching it), but it doesn’t look like the condition I’ve constructed above is supported by Bubble, making it impossible(?) to use the Data Privacy section to enable this use case.

Anyway, I don’t think I want to go down the path of doing something like locking down pages based on roles; I simply want to find a way to show/hide a “thing” given a connection between its creator and the user who is currently logged in. Is that possible?

Apologies in advance if I am way out in left field with my question and/or how I have gone about bringing it to the community, but any insight on this one from the knowledgeable and helpful folks out here would be greatly appreciated.

Thanks so much…

Mike


#2

Hi there @mikeloc

I would have done the same thing, but change a minor thing. That is the way your privacy condition is handled. I would do When this thing’s collaborator contains current user (so skip the creator’s)

Add to that list user A and its collaborators and you’re done (or you can do privacy rule and look at the creator if you want to split the privacy)


#3

Thanks so much for the response, @kh.japtjong… I really appreciate it!

I had thought of structuring the privacy condition the way you have suggested, but I couldn’t get my head around it because a thing doesn’t have collaborators; the user who created the thing has them. If I understand your response correctly, I have to get the creator’s list of collaborators into the thing’s record in the database. Then, when each thing is created, it has an associated list of collaborators, which would enable the privacy condition to work the way you have structured it.

If that’s that the case, the question is how do I get the list of a creator’s collaborators into the thing’s record. I assume user A could have a list of collaborators that had been input via a separate form, and when user A creates a thing, the list of collaborators could get copied into the thing’s record. However, wouldn’t that list be static and only include collaborators who existed at the time of the creation?

So, if user A currently has users B and C as collaborators and user A creates thing A, users A, B, and C would be able to view/edit thing A. But, if user A eventually adds user D as a collaborator, thing A would have no knowledge that use D is a collaborator because it was created before user A added user D, and therefore user D would not be able to view/edit thing A.

Does any of that make sense? Please accept my sincerest apology if I have misunderstood your response or if what I have written above is, well, gibberish… I’m pretty new to all of this but I really want to understand it because Bubble rocks and I want to use it to create my app.

Thanks again for your time… I really do appreciate it.

Best…

Mike


#4

Hi Mike,

I think I am the one that misunderstood things. So let me get this right; collaborators are linked to a user and not to a thing. Gotcha!

So there are a few options depending on what you want.

Privacy role

With the privacy role you can determine if a user can or cannot see the data. If that is want you want, use the privacy role

Then I would do the following (similar as to you did). In the User table create a field called Collaborators which is a list of users.

Than in the privacy of the project (or thing) your privacy statement would be This Project’s Creator’s Collaborator contains Current User

If you want different rights for the creator, create a new role otherwise you can add to the above with or This Project’s Creator is Current User

I tried in a test app and it works. And this is the way you can hide or show data.

Editing rights

If you want user’s to see the data, but determine if they can edit or not then you could show/hide the edit button, which for example opens a popup. by use the conditions of that button. Then you could hide/show the edit button (which makes editing possible) by setting a condition on that button saying this element is visible when Creator’s Colaborator contains Current User

Hide group

You can also hide elements (put those elements in groups for easy management). You can use the same restriction rule as with editing rights only use it to hide a group of elements which holds the data you wish to show/hide


#5

Thanks for responding again, @kh.japtjong… very much appreciated.

The interesting thing is that what you have described under privacy role is literally the first thing I tried when I started looking at this days ago, but Bubble doesn’t seem to like that construct for the privacy statement. Here is what I get when I just tried it in a test app…

I believe I have the exact same construct you have suggested, but you can see the errors I am getting. Any thoughts on what we are doing differently that causes it to work for you but not for me?

Thanks again…

Mike


#6

Hi Mike,

Can you show me a screenshot of the data field? For me it works, but thats because the collaborator field within my user table is a list of users


#7

Oh, geez… I thought I had the collaborator field set up as a list of users but it was a list of texts. I feel pretty silly now, but it’s nice to know I was on the right track all along.

I still see the “Rules that use “This Human’s X’s Y” can’t grant search access right now” message underneath the rule, but I’m assuming that’s just a current limitation that doesn’t affect data privacy/access.

I can’t thank you enough for your time, @kh.japtjong… hopefully I can up my Bubble knowledge to the point where I can return the favor to you or others at some point down the line.

Thanks again!

Best…

Mike


#8

Hmm… it still doesn’t appear to be working. I am showing the humans in a repeating group on a page, and the repeating group shows them by doing a search, of course, so it looks like the “Rules that use “This Human’s X’s Y” can’t grant search access right now” limitation is getting in the way.

Oh well, back to the drawing board, I guess.


#9

I dont know what your privacy preference is, but you can alter the searchbox to only show “Human’s” that are accessible by users in the Collaborators list of user.