Skip to content
Snippets Groups Projects
Commit 2233d1a5 authored by Rasmus Fuhse's avatar Rasmus Fuhse
Browse files

Resolve "Löschen von InstituteMember schlägt fehl"

parent 4625c1cd
No related branches found
No related tags found
No related merge requests found
......@@ -74,6 +74,15 @@ class InstituteMember extends SimpleORMap implements PrivacyObject
$config['additional_fields']['institute_name'] = [];
$config['registered_callbacks']['after_delete'][] = function ($member) {
$institute = $member->institute;
$user_id = $member->user_id;
if ($institute) {
$institute->status_groups->removeUser($user_id, true);
}
};
parent::configure($config);
}
......@@ -170,24 +179,6 @@ class InstituteMember extends SimpleORMap implements PrivacyObject
return true;
}
/**
* Removes a user from an institute. Removes the user from all
* statusgroups as well.
*
* @return int number of deleted institute member records
*/
public function delete()
{
$institute = $this->institute;
$user_id = $this->user_id;
if ($result = parent::delete()) {
$institute->status_groups->removeUser($user_id, true);
}
return $result;
}
/**
* Export available data of a given user into a storage object
* (an instance of the StoredUserData class) for that user.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment