Skip to content

Commit

Permalink
Fixed issue #17590: Role reseted after checkintegrity (#2036)
Browse files Browse the repository at this point in the history
Co-authored-by: encuestabizdevgit <devgit@encuesta.biz>
  • Loading branch information
gabrieljenik and encuestabizdevgit committed Sep 15, 2021
1 parent 03c4724 commit b8671cb
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions application/controllers/admin/checkintegrity.php
Expand Up @@ -541,13 +541,14 @@ protected function _checkintegrity()
/* Find is some fix is done */
$bDirectlyFixed = false;
$aFullOldSIDs = array();
// Delete survey permissions if the user does not exist
// Delete survey and global permissions if the user does not exist
$oCriteria = new CDbCriteria();
$oCriteria->join = 'LEFT JOIN {{users}} u ON {{permissions}}.uid=u.uid';
$oCriteria->condition = '(u.uid IS NULL)';
$oCriteria->addCondition('u.uid IS NULL');
$oCriteria->addCondition("{{permissions}}.entity <> 'role'");
if (App()->db->driverName == 'pgsql') {
$oCriteria->join = 'USING {{users}} u';
$oCriteria->condition = '{{permissions}}.uid=u.uid AND (u.uid IS NULL)';
$oCriteria->addCondition('{{permissions}}.uid=u.uid');
}
if (Permission::model()->deleteAll($oCriteria)) {
$bDirectlyFixed = true;
Expand Down

0 comments on commit b8671cb

Please sign in to comment.