- Issue created by @titouille
Hi,
I have a basic question about group_membership relationship.
I try to build a community system with group module. The system has a "structure" group type. Each structure has a particular type (ie organization, services provider, ...) and can, of course, add / remove members.
In the system, there is multiple kind of user, based on a member-relationship field.
The field allow to choose the kind of relationship that link the user to the structure as member :
A real example :
The structure X create events, and build an "organization" group, called "organization X".
User A, B and C are "structure core members" of the organization X.
Now, User B is already member of another structure, that provide services about events, for example specialized to set up sound system.
On the group administration page, my goal is to display some lists :
Actually, I see that the group_membership plugin has a cardinality locked to 1. But as I see, we can add members multiple times using code ($group->addRelationship($user, 'group_membership', [ my values... ]);
In this case, I have multiples times the same user as member, but when I try to edit one of these relationships, group save relationship and add new relationships for the same user. Example : I have two time the user C. I edit one of the relation to change some fields values. I save the changes, and now I have 4 time the same user as member.
I tried to change my mindset and build a module with new @GroupRelationType to add structures as "participant" in other structures. In this case, all can work together because only one structure represent a participant, no need to add multiple time the same entity... But if I indicate "group" as entity_type_id, the following error message is displayed :
The "group_participant" plugin defines entity access over group entities. This should be dealt with by altering the group permissions of the current user.
And I don't understand what I can do to avoid this error message, I'm logged as super-admin...
Subgroup is not a solution because a subgroup can't be the same type of it's parent.
If anyone can help me to find a way or give some suggestions to build this kind of system it would be very helpful.
Active
3.2
Code