/** * Synchronizes a single user in LDAP. This method can be used by superusers to synchronize * a user before (s)he logs in. * * @param string $login The login of the user. * @throws Exception if the user cannot be found or a problem occurs during synchronization. */ public function synchronizeUser($login) { Piwik::checkUserHasSuperUserAccess(); $ldapUser = $this->ldapUsers->getUser($login); if (empty($ldapUser)) { throw new Exception(Piwik::translate('LoginLdap_UserNotFound', $login)); } $this->userSynchronizer->synchronizeLdapUser($login, $ldapUser); $this->userSynchronizer->synchronizePiwikAccessFromLdap($login, $ldapUser); }
public function test_synchronizeLdapUser_Succeeds_IfUserDoesNotExistInDb() { $this->setUserManagerApiMock($throws = false); $this->setUserModelMock(null); $this->userSynchronizer->synchronizeLdapUser('piwikuser', array()); }
protected function synchronizeLdapUser($ldapUser) { $this->userForLogin = $this->userSynchronizer->synchronizeLdapUser($this->login, $ldapUser); $this->userSynchronizer->synchronizePiwikAccessFromLdap($this->login, $ldapUser); }