public function test_synchronizePiwikAccessFromLdap_Succeeds_IfLdapUserHasNoAccess()
 {
     $this->setUserManagerApiMock($throwsOnAdd = false);
     $this->setUserAccessMapperMock(array());
     $this->userSynchronizer->synchronizePiwikAccessFromLdap('piwikuser', array());
     $this->assertEquals(array(), $this->userAccess);
     $this->assertEquals(array(), $this->superUserAccess);
 }
Ejemplo n.º 2
0
 /**
  * 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);
 }
Ejemplo n.º 3
0
 protected function synchronizeLdapUser($ldapUser)
 {
     $this->userForLogin = $this->userSynchronizer->synchronizeLdapUser($this->login, $ldapUser);
     $this->userSynchronizer->synchronizePiwikAccessFromLdap($this->login, $ldapUser);
 }