Attaching a member to multiple groups

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
utony
Veteran Member
Posts:153
Joined: 2020-04-03 18:37

Attaching a member to multiple groups

Post by utony » 2026-02-09 16:14

I have a use case where I am looking for possible options to attach a member to inherit the permissions of multiple groups. Is this something that can be done with AG?

Tony

ppfoong
Veteran Member
Posts:94
Joined: 2021-07-13 16:46

Re: Attaching a member to multiple groups

Post by ppfoong » 2026-02-10 16:15

You can use individual permission for that member instead.

saymaad
AppGini Super Hero
AppGini Super Hero
Posts:131
Joined: 2024-06-03 16:17

Re: Attaching a member to multiple groups

Post by saymaad » 2026-02-11 08:44

ppfoong wrote: ↑
2026-02-10 16:15
You can use individual permission for that member instead.
In small businesses, multiple roles are often assigned to the same individual, and in such cases it makes perfect sense to want what Tony is describing.

For example, suppose you have an Administration Executive and an HR Executive, each belonging to their respective member groups. The organization then hires a Senior Executive who will handle both Admin and HR tasks when needed, and also oversee daily operations. Similarly, a Manager might need access across Administration + HR + IT. Instead of creating new hybrid groups or manually assigning individual permissions every time, the ability for a single member to inherit permissions from multiple existing groups would solve the problem cleanly by creating:
  • Administration Group for Admin. Executive
  • HR Group for HR Executive
  • IT Group for IT Officer
Then we simply assign:
  • Senior Executive the groups for Admin + HR
  • Manager the groups for Admin + HR + IT
This keeps groups meaningful, avoids duplication, and maintains a clear permission structure. In fact, this is exactly how most mature systems handle permissions. A few examples:
  • Active Directory: A user can belong to multiple security groups, and their effective permissions are the union of all groups. This is one of the most widely used RBAC models in the world.
  • Epicor ERP: Users can belong to multiple security groups, each granting different menu/process permissions. Effective access is the sum of all assigned groups.
  • Oracle ERP Cloud / Oracle Fusion: Users can be assigned multiple job roles, abstract roles, and duty roles. Oracle’s RBAC model is explicitly multi‑role, and permissions are additive.
  • ERPNext: Users can have multiple roles at the same time (e.g., HR User + Accounts User + Projects User). Permissions from all assigned roles are combined.
Like Tony, I also am interested into a similar feature or possible customization.

-Saymaad

pbottcher
AppGini Super Hero
AppGini Super Hero
Posts:1757
Joined: 2018-04-01 10:12

Re: Attaching a member to multiple groups

Post by pbottcher » 2026-02-11 11:06

Any help offered comes with the best of intentions. Use it at your own risk. In any case, please make a backup of your existing environment before applying any changes.

User avatar
jsetzer
AppGini Super Hero
AppGini Super Hero
Posts:2027
Joined: 2018-07-06 06:03
Location: Kiel, Germany
Contact:

Re: Attaching a member to multiple groups

Post by jsetzer » 2026-02-11 12:17

I absolutely agree with all of you.

As of today, user permissions could solve this requirement, if just handling was easy enough. :cry:

Now, this is a many-years-old topic, and if I remember right, one of my very first forum posts (many years ago) was about this. In the past I've started building a helper for my purposes. I don't have a UI, but let me show my implementation which makes it easy, even for non-professional coders, to assign member(s) to multiple groups:

Code sample with some comments

Code: Select all

$helper = new \Helper\MultiGroupMembership\Configurator();

// find (multiple) groups by name
$groups = $helper->findGroups('test', 'Gruppe 1a Sachbearbeiter');

// find (multiple) users by memberID
$members = $helper->findMembers('test', 'user 1');

// assign members to selected groups
$success = $helper->assign($members)->to($groups);
That's it. My code gathers and merges the selected groups' permissions and applies them to the selected users.

Result

This is from user-specific permissions (not group-permissions):
chrome_XTPxTv3r7t.png
chrome_XTPxTv3r7t.png (19.91 KiB) Viewed 2919 times



Challenge

The biggest challenge is about mismatching group-permissions:
Imagine group1 is allowed to insert into table1 but group2 is not. It's even more complicated with view, edit and delete permissions which can be None, User, Groupor All.

Now, in these cases I've decided to allow insert if at least one group it allowed to. Similar for the others: If one of user's groups is allowed to edit all, the user should be allowed to edit all.
Some may have a different opinion about this. But, actually, it would be easy to implement it vice-versa (more restrictive).


There is a small helper-routine for removing all user-specific records:

Code: Select all

$all_members = $helper->getMembers();
$confirm_delete = true;
$helper->reset($all_members, $confirm_delete);
Remarks

As mentioned above, this is pure PHP code, no UI, yet. If there is interest I could add a user interface (UI), for example as custom page. If you are interested, please contact me directly.

Any comments?

You may check the additional screenshots below...
Attachments
Code_TmrGvTAP2u.png
Some more code
Code_TmrGvTAP2u.png (45.73 KiB) Viewed 2919 times
chrome_TQ0GNsxG7v.png
List of Groups
chrome_TQ0GNsxG7v.png (2.65 KiB) Viewed 2919 times
chrome_MWByUf01yP.png
List of Members
chrome_MWByUf01yP.png (4.53 KiB) Viewed 2919 times
Kind regards,
Jan <js />

AppGini 26.12 + all AppGini Helper tools

My Side Project
www.office-app.com | Coding Sample | Changelog | Blog | Top 20 Features
Integrated Statemachine Workflow • KANBAN • Audit Trail • Integrated API • Model Driven • Field-Level permission • Modern UI

My Company Website
www.bizzworxx.de

My AppGini Blog
appgini.bizzworxx.de/blog

You can help us helping you:
Please always put code fragments inside [code]...[/code] blocks for better readability Image

Post Reply