Skip to content

Commit

Permalink
Merge branch '2024.11'
Browse files Browse the repository at this point in the history
  • Loading branch information
gitlabci committed Feb 18, 2025
2 parents fc96a4d + 02c446f commit 2b8d0df
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions ci/gitlab-ci/test_php_jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ php-unit-servertests-source:
- "tine20/Tinebase/User.php"
- "tine20/Tinebase/User/*.php"
- "tine20/Tinebase/User/LdapPlugin/*.php"
- "tine20/Tinebase/Group.php"
- "tine20/Tinebase/Group/*.php"
- "tine20/Tinebase/Group/LdapPlugin/*.php"
- if: $CI_PIPELINE_SOURCE == "merge_request_event" && $CI_MERGE_REQUEST_LABELS =~ /php-unit-all-tests-ldap-source/
Expand Down
17 changes: 12 additions & 5 deletions tine20/Tinebase/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,12 +146,12 @@ public static function factory($_backendType)
}

/**
* syncronize groupmemberships for given $_username from syncbackend to local sql backend
* synchronize group memberships for given $_username from sync backend to local sql backend
*
* @todo sync secondary group memberships
* @param mixed $_username the login id of the user to synchronize
*/
public static function syncMemberships($_username)
public static function syncMemberships($_username): void
{
if ($_username instanceof Tinebase_Model_FullUser) {
$username = $_username->accountLoginName;
Expand All @@ -162,6 +162,7 @@ public static function syncMemberships($_username)
Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . " Sync group memberships for: " . $username);

$userBackend = Tinebase_User::getInstance();
/** @var Tinebase_Group_Ldap $groupBackend */
$groupBackend = Tinebase_Group::getInstance();
$adbInstalled = Tinebase_Application::getInstance()->isInstalled('Addressbook');

Expand All @@ -170,7 +171,11 @@ public static function syncMemberships($_username)

$user = $userBackend->getUserByProperty('accountLoginName', $username, 'Tinebase_Model_FullUser');

$membershipsSyncBackend = $groupBackend->getGroupMembershipsFromSyncBackend($user);
try {
$membershipsSyncBackend = $groupBackend->getGroupMembershipsFromSyncBackend($user);
} catch (Tinebase_Exception_NotFound $tenf) {
$membershipsSyncBackend = [];
}
if (! in_array($user->accountPrimaryGroup, $membershipsSyncBackend)) {
$membershipsSyncBackend[] = $user->accountPrimaryGroup;
}
Expand All @@ -180,8 +185,10 @@ public static function syncMemberships($_username)
sort($membershipsSqlBackend);
sort($membershipsSyncBackend);
if ($membershipsSqlBackend == $membershipsSyncBackend) {
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__
. ' Group memberships are already in sync.');
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__
. ' Group memberships are already in sync.');
}

Tinebase_TransactionManager::getInstance()->commitTransaction($transactionId);
$transactionId = null;
Expand Down

0 comments on commit 2b8d0df

Please sign in to comment.