Skip to content
Snippets Groups Projects
Commit ebebd2e9 authored by Moritz Strohm's avatar Moritz Strohm
Browse files

prevent temporary permissions to be deleted when managing them for one user, re #2158

Merge request studip/studip!2019
parent 48f70321
No related branches found
No related tags found
No related merge requests found
...@@ -1125,30 +1125,32 @@ class Resources_ResourceController extends AuthenticatedController ...@@ -1125,30 +1125,32 @@ class Resources_ResourceController extends AuthenticatedController
} }
} }
//Now we must remove all permissions where the resource_id is given $deleted_permissions = 0;
//and where the user_id is not in the $user_ids array which has been if (!$this->single_user_mode) {
//filled above. //Now we must remove all permissions where the resource_id is given
if ($user_ids) { //and where the user_id is not in the $user_ids array which has been
$deleted_permissions = ResourceTemporaryPermission::deleteBySql( //filled above.
'resource_id = :resource_id if ($user_ids) {
AND $deleted_permissions = ResourceTemporaryPermission::deleteBySql(
user_id NOT IN ( :user_ids )', 'resource_id = :resource_id
[ AND
'resource_id' => $this->resource_id, user_id NOT IN ( :user_ids )',
'user_ids' => $user_ids [
] 'resource_id' => $this->resource_id,
); 'user_ids' => $user_ids
} else { ]
//In case no user_ids are collected above all permissions );
//for the resource have to be deleted: } else {
$deleted_permissions = ResourceTemporaryPermission::deleteBySQL( //In case no user_ids are collected above all permissions
'resource_id = :resource_id', //for the resource have to be deleted:
[ $deleted_permissions = ResourceTemporaryPermission::deleteBySQL(
'resource_id' => $this->resource_id, 'resource_id = :resource_id',
] [
); 'resource_id' => $this->resource_id,
]
);
}
} }
if (count($errors)) { if (count($errors)) {
PageLayout::postError( PageLayout::postError(
_('Die folgenden Fehler traten auf beim Speichern der Berechtigungen:'), _('Die folgenden Fehler traten auf beim Speichern der Berechtigungen:'),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment