Skip to content

Commit

Permalink
Fixed issue #17185: Template permissions deleted when editing global …
Browse files Browse the repository at this point in the history
…permissions

Dev: template didn't have entity_id
  • Loading branch information
Shnoulle committed Mar 16, 2021
1 parent 54d2ef6 commit 6b4e12c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion application/controllers/UserManagementController.php
Expand Up @@ -1455,11 +1455,15 @@ public function generateAdminCreationEmail($fullname, $username, $password, $iNe
*/
protected function applyPermissionFromArray($iUserId, $aPermissionArray)
{
//Delete all current Permissions
$oCriteria = new CDbCriteria();
$oCriteria->compare('uid', $iUserId);
// without entity
$oCriteria->compare('entity_id', 0);
//Delete all Permissions without entity.
// except for template entity (no entity_id is set here)
$oCriteria->compare('entity', "<>template");
Permission::model()->deleteAll($oCriteria);

$results = [];
//Apply the permission array
foreach ($aPermissionArray as $sPermissionKey => $aPermissionSettings) {
Expand Down

0 comments on commit 6b4e12c

Please sign in to comment.