Skip to content

Commit

Permalink
tweak(TB AD) user sync group pwd cant change sddl fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmhh committed Dec 18, 2024
1 parent 901c5c5 commit 15a9229
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tine20/Tinebase/User/ActiveDirectory.php
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,8 @@ public function addUserToSyncBackend(Tinebase_Model_FullUser $_user)
$user = $this->getUserByPropertyFromSyncBackend('accountId', $_user, 'Tinebase_Model_FullUser');

if (Tinebase_Config::getInstance()->{Tinebase_Config::USERBACKEND}->{Tinebase_Config::SYNCOPTIONS}->{Tinebase_Config::PWD_CANT_CHANGE}) {
$user->accountId = $_user->accountId;
$user->xprops()[static::class]['syncId'] = $_user->xprops()[static::class]['syncId'];
$this->updateUserInSyncBackend($user);
$user = $this->getUserByPropertyFromSyncBackend('accountId', $_user, 'Tinebase_Model_FullUser');
}
Expand Down Expand Up @@ -571,6 +573,8 @@ protected function _user2ldap(Tinebase_Model_FullUser $_user, array $_ldapEntry
);
if (Tinebase_Config::getInstance()->{Tinebase_Config::USERBACKEND}->{Tinebase_Config::SYNCOPTIONS}->{Tinebase_Config::PWD_CANT_CHANGE}
&& ($_ldapEntry['ntsecuritydescriptor'][0] ?? false)) {
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG))
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' start parsing sddl');
try {
$sddl = SDDL::fromBytes($_ldapEntry['ntsecuritydescriptor'][0]);
$foundSelf = false;
Expand Down Expand Up @@ -629,6 +633,8 @@ protected function _user2ldap(Tinebase_Model_FullUser $_user, array $_ldapEntry
}

$ldapData['ntsecuritydescriptor'] = $sddl->toBytes();
if ($_ldapEntry['ntsecuritydescriptor'][0] !== $ldapData['ntsecuritydescriptor'] && Tinebase_Core::isLogLevel(Zend_Log::DEBUG))
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' changing ntsecuritydescriptor');
} catch (\Tine\SDDL_Parser\ParserException $e) {
Tinebase_Exception::log($e);
}
Expand Down

0 comments on commit 15a9229

Please sign in to comment.