/**
  * Hook
  *
  * @param Array $params
  *
  * @return void
  */
 function codendi_daily_start($params)
 {
     if ($GLOBALS['sys_auth_type'] == 'ldap' && $this->isDailySyncEnabled()) {
         $ldapQuery = new LDAP_DirectorySynchronization($this->getLdap(), $this->getLogger());
         $ldapQuery->syncAll();
         $retentionPeriod = $this->getLdap()->getLDAPParam('daily_sync_retention_period');
         if ($retentionPeriod != NULL && $retentionPeriod != "") {
             $ldapCleanUpManager = new LDAP_CleanUpManager($retentionPeriod);
             $ldapCleanUpManager->cleanAll();
         }
         //Synchronize the ugroups with the ldap ones
         $ldapUserGroupManager = new LDAP_UserGroupManager($this->getLdap());
         $ldapUserGroupManager->synchronizeUgroups();
         return true;
     }
 }
Beispiel #2
0
        }
        $percentage_users_to_suspend = $nbr_users_to_suspend / $nbr_active_users * 100;
        echo "Number of users that will be suspended     : " . $nbr_users_to_suspend . "\n";
        echo "Number of active users                     : " . $nbr_active_users . "\n";
        if (!($threshold_users_suspension = $ldapPlugin->getLdap()->getLDAPParam('threshold_users_suspension'))) {
            echo "Threshold                                  : Is Not defined \n";
        } else {
            echo "Threshold                                  : " . $threshold_users_suspension . " % \n";
        }
        echo "Percentage of users that will be suspended : " . $percentage_users_to_suspend . " % \n";
        echo "--------------------------------------------------- List of users that will be suspended :  \n";
        foreach ($users_to_suspend as $user) {
            echo "id     : " . $user->getId() . "\n";
            echo "login  : "******"\n";
            echo "name   : " . $user->getRealName() . "\n";
            echo "e-mail : " . $user->getEmail() . "\n";
            echo "--------------------------------------------------- \n";
        }
    } else {
        $ldapQuery->syncAll();
        $retentionPeriod = $ldapPlugin->getLdap()->getLDAPParam('daily_sync_retention_period');
        if ($retentionPeriod != NULL && $retentionPeriod != "") {
            $ldapCleanUpManager = new LDAP_CleanUpManager($retentionPeriod);
            $ldapCleanUpManager->cleanAll();
        }
        $time_end = microtime(true);
        $time = $time_end - $time_start;
        echo "Time elapsed: " . $time . "\n";
        echo "LDAP time: " . $ldapQuery->getElapsedLdapTime() . "\n";
    }
}