diff options
| author | Thomas Hackl <hackl@data-quest.de> | 2022-08-09 17:24:41 +0200 |
|---|---|---|
| committer | Thomas Hackl <hackl@data-quest.de> | 2022-08-09 17:24:41 +0200 |
| commit | de32ac3ea1953219f6e0f4677bc04d7a063d51bb (patch) | |
| tree | c793d0c9a0739ba3d5cf9fefd52e64174a29984d /lib/models/InstituteMember.class.php | |
| parent | b54ea35f36b02de8b260e41073de6cb24c653e0b (diff) | |
add additional handlers on creating/deleting SORM objects, re #688tic-688
Diffstat (limited to 'lib/models/InstituteMember.class.php')
| -rw-r--r-- | lib/models/InstituteMember.class.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/models/InstituteMember.class.php b/lib/models/InstituteMember.class.php index a501c61..d7d7daa 100644 --- a/lib/models/InstituteMember.class.php +++ b/lib/models/InstituteMember.class.php @@ -85,6 +85,21 @@ class InstituteMember extends SimpleORMap implements PrivacyObject if ($institute) { $institute->status_groups->removeUser($user_id, true); + + AutoInsert::instance()->saveUser($user_id, $member->inst_perms, 'institute', + $member->institut_id); + } + }; + + $config['registered_callbacks']['after_create'][] = function ($member) { + AutoInsert::instance()->saveUser($member->user_id, $member->inst_perms, 'institute', + $member->institut_id); + }; + + $config['registered_callbacks']['before_update'][] = function ($member) { + if ($member->isFieldDirty('inst_perms')) { + AutoInsert::instance()->saveUser($member->user_id, $member->inst_perms, 'institute', + $member->institut_id); } }; |
