App that uses some kind of "sharing"

Hi adalo experts 🙂 pls we need help 🙏

we are facing an issue. We would like to build an app that uses some kind of “sharing”. So users can manage multiple database objects with different type of permissions. I’ll give an example.

There is Joe who is owner of Company A and employee of Company B. Then there is Dave who is owner of Company B.

Let’s say we have database collection called “Companies”. Usually (in normal database) there would be table with these rows (very simple):

ID, company name

1, Company A,

2, Company B

Users table:

ID, user name

1, Joe

2, Dave

Then there would be table Company_data:

ID, Company_ID, user_id, permissions

1, 1, 1, owner

2, 2, 1, employee

3, 2, 2, owner

There also table events:

ID, event name, company_id, date

1, Dinner at Hotel, 2, 27-12-2021 21:45

Now we don’t know how to build that. Second issue is that user can only see 1 company at a time AND can / cannot edit data based on permissions (which owner can change).

What’s the use case for this? So you can add multiple people to a bill?

I don’t understand why Joe is an owner of a company but an employee of another company.

You could have organizations and allow users to be a part of multiple orgs, then have a role collection with role type, user, org.

I’m trying to understand what you want to achieve here though because I think there’s a better way to achieve this without doing it the way you mentioned.

Well, we tried to make it universal from description point of view. Points is that the app has “projects”. These projects have multiple users with different type of permissions (some users can only view data, some can edit them).
And the projects (aka companies in our example), have other collections bounds to it. Like project can have “events” 1 project : N events … or budgets (once again, 1:N) … and then e.g. budgets can have expenses (1 budget : N expenses).

Okay, you have to be pretty specific with your requests because it’s tech - there are a lot of different ways to accomplish the same thing, some better than others.

For this, I’d do the following:

  1. Users can create a project. When they create a project, they create a referral code. This gives users the ability to join the project (without the project being visible to everyone).
  2. All users have some functionality to join a project by entering the referral code. You can use this for reference - Adalo Referral Code Tutorial - YouTube
  3. When the user joins the project, have an admin approve them and assign rights (edit y/n). This is half of that process - Creating a User Approval Process in Adalo - YouTube
  4. Filter all edit button visibility to only be visible to if logged in user has edit rights to current project.

If you only have 2 access levels - edit, read only, then all the better. You can use binary features for that (edit y/n) and make edit only visible to yes. If you have N>2 states, then you’ll need to think about adding roles rule engine.

Hope that helps.

Hi Erik,
thanks for helping, probably we can do it like you sad…

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.