From 8086295cb5112d35208894f371abcccb2d8d121b Mon Sep 17 00:00:00 2001 From: Moritz Strohm <strohm@data-quest.de> Date: Tue, 10 May 2022 10:14:07 +0000 Subject: [PATCH] fix for BIESt #977 Merge request studip/studip!562 --- lib/classes/UserManagement.class.php | 11 +++++++++++ lib/models/resources/ResourceProperty.class.php | 8 ++++++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/classes/UserManagement.class.php b/lib/classes/UserManagement.class.php index 3a98719c489..2dc1f59e633 100644 --- a/lib/classes/UserManagement.class.php +++ b/lib/classes/UserManagement.class.php @@ -1005,6 +1005,17 @@ class UserManagement } if ($delete_personal_documents && $delete_personal_content && $delete_names && $delete_memberships) { + // Delete the user from resource property entries of type "user": + ResourceProperty::deleteBySQL( + "`property_id` IN ( + SELECT `property_id` + FROM `resource_property_definitions` + WHERE `type` = 'user' + ) + AND `state` = :user_id", + ['user_id' => $this->user_data['auth_user_md5.user_id']] + ); + // delete Stud.IP account $query = "DELETE FROM user_info WHERE user_id = ?"; $statement = DBManager::get()->prepare($query); diff --git a/lib/models/resources/ResourceProperty.class.php b/lib/models/resources/ResourceProperty.class.php index 1e6cdf85eee..78101aac786 100644 --- a/lib/models/resources/ResourceProperty.class.php +++ b/lib/models/resources/ResourceProperty.class.php @@ -51,7 +51,7 @@ class ResourceProperty extends SimpleORMap parent::configure($config); } - + /** * Determines whether this resource property is requestable * by checking the requestable flag of the corresponding @@ -99,7 +99,11 @@ class ResourceProperty extends SimpleORMap $string .= $this->state; } elseif ($this->type == 'user') { $user = User::find($this->state); - $string .= $user->getFullName(); + if ($user) { + $string .= $user->getFullName(); + } else { + $string .= _('unbekannt'); + } } else { $string .= $this->state; } -- GitLab