Group access, a smarter way?

Hello all,
I’ve read through everything possible and watched tutorials but I’m going in circles.

I want the user to be able to select a group at startup. in this group he can create articles that are only displayed in this group for all group members.

So I have User / artikels / groups

Relationships:

User can have multiple groups, groups can have multiple users
Groups can have multiple artikels, a artikel can have only one group

If I want to show them in a list now, of course all articels of the users groups are shown and not just the from the one he choose.

My decision now:
I gave the user a property “Active group” and when he chooses one group, its set to the group name.
The Artikel gets a property group and every new artikel sets those property to logged in users active group.

Is there a smarter way or did i something wrong in my database relations?

Hi Dominik,

Welcome to the community :partying_face:

So the user can have only 1 group right? Then you don’t need a Many to Many relationship. You can have a One to Many relationship.

You can add a One to Many relationship. Means the user can have one group and a group can have many users.

Then you can filter the Articles list by filtering it from the Logged in user’s group!

You can change All Articles to More>Logged in user’s>Group’s>Article’s>All or you can keep that as All Articles and you can add a custom filter that Group’s name>is equal to>Logged in user’s>group name.

And when creating Articles you can add Logged in user>Group in the form automatically section.

If the user can have many groups then you need a Many to Many relationship

and after Signup you can link the user to a new screen that the screen has a list and a toggle has added inside the list to add groups for the logged in user.

And you can add a filter to the Articles list that Group’s>Users>All>Contains>Logged in user and in the creating article form you can add the Group property ( The One to many relationship created between Articles and Groups ) to the visible field and add a filter that Users>All>Contains>Logged in user and then a drop down will be visible that has Logged in user selected groups.

Thank you

Thank you for this long answer.
I build it like that but the datas doesnt arrive at the correct point.
When I built a empty app just with this components it works.
I havent figured out correctly why sometimes some datas are avaiable and sometimes not.
I think I have to dig a bit deeper.

Another problem:
I want every user to have a money balance within the group. Means in one group he can have $10 in the other $20
So I made a collection “balance” with relation:
a user can have multiple balance’s a balance belongs to one user
a group can have multiple balance a balance belongs to one group

When I want to filter the list now, I can just filter:
current group->balance
or
loged in user->balance

But I need logged in users current groups guthaben.

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