TASK-290 Fix the group sync in the ldap cron

This commit is contained in:
Brayan Pereyra
2025-10-07 11:13:49 -04:00
parent 0b0a176058
commit b6b7103624
3 changed files with 379 additions and 26 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,26 +1,8 @@
<?php
/**
* users_ViewPhoto.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
use ProcessMaker\Model\User;
if (($RBAC_Response = $RBAC->userCanAccess( "PM_LOGIN" )) != 1)
return $RBAC_Response;
@@ -30,8 +12,23 @@ $direction = PATH_IMAGES_ENVIRONMENT_USERS . $_REQUEST['pUID'] . ".gif";
if (! file_exists( $direction )) {
$direction = PATH_HOME . 'public_html/images/user.gif';
$user = new User();
$filters = array(
'limit' => 1,
'fields' => ['USR_UID'],
'conditions' => [['USR_ID', '=', $_REQUEST['pUID']]]
);
$result = $user->show($filters);
if ($result['total'] == 1){
$direction = PATH_IMAGES_ENVIRONMENT_USERS . $result['data'][0]['USR_UID'] . ".gif";
if (! file_exists( $direction )) {
$direction = PATH_HOME . 'public_html/images/user.gif';
}
} else {
$direction = PATH_HOME . 'public_html/images/user.gif';
}
}
G::sendHeaders( $direction );
DumpHeaders( $direction );

View File

@@ -170,7 +170,7 @@ class GroupUser extends Model
}
}
public static function getUsersByGroupId($groupUid, $filters = [])
public static function getUsersByGroupId($filters = [])
{
$query = static::query();
@@ -178,8 +178,11 @@ class GroupUser extends Model
$query->select($filters['fields']);
}
$query->where('GROUP_USER.GRP_UID', $groupUid);
$query->innerJoin('GROUP_USER.USR_UID', '=', 'USERS.USR_UID');
if (!empty($filters['conditions']) && is_array($filters['conditions'])) {
$query->where($filters['conditions']);
}
$query->leftJoin('USERS', 'GROUP_USER.USR_UID', '=', 'USERS.USR_UID');
$total = $query->count();