Example #1
0
 /**
  * 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;
     }
 }
Example #2
0
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Codendi; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */
ini_set('max_execution_time', 0);
ini_set('memory_limit', -1);
require_once 'pre.php';
$time_start = microtime(true);
// First: check if LDAP plugin is active
$pluginManager = PluginManager::instance();
$ldapPlugin = $pluginManager->getPluginByName('ldap');
if ($pluginManager->isPluginAvailable($ldapPlugin)) {
    $ldapQuery = new LDAP_DirectorySynchronization($ldapPlugin->getLdap(), $ldapPlugin->getLogger());
    //If script is executed with --dry-run option
    if (isset($argv[1]) && $argv[1] == "--dry-run") {
        $users_to_suspend = $ldapQuery->getLdapUserManager()->getUsersToBeSuspended();
        $nbr_users_to_suspend = count($users_to_suspend);
        $nbr_active_users = $ldapQuery->getLdapUserManager()->getNbrActiveUsers();
        if ($nbr_users_to_suspend == 0) {
            echo "No user will be suspended \n";
            return;
        }
        $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 {
Example #3
0
 /**
  * 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());
         $ldapQuery->syncAll();
     }
 }
Example #4
0
 * Codendi is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Codendi is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Codendi; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */
ini_set('max_execution_time', 0);
ini_set('memory_limit', -1);
require_once 'pre.php';
require_once dirname(__FILE__) . '/../include/LDAP_DirectorySynchronization.class.php';
$time_start = microtime(true);
// First: check if LDAP plugin is active
$pluginManager = PluginManager::instance();
$ldapPlugin = $pluginManager->getPluginByName('ldap');
if ($pluginManager->isPluginAvailable($ldapPlugin)) {
    $ldapQuery = new LDAP_DirectorySynchronization($ldapPlugin->getLdap());
    $ldapQuery->syncAll();
    $time_end = microtime(true);
    $time = $time_end - $time_start;
    echo "Time elapsed: " . $time . "\n";
    echo "LDAP time: " . $ldapQuery->getElapsedLdapTime() . "\n";
}
Example #5
0
 /**
  * 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());
         $ldapQuery->syncAll();
         //Synchronize the ugroups with the ldap ones
         $ldapUserGroupManager = new LDAP_UserGroupManager($this->getLdap());
         $ldapUserGroupManager->synchronizeUgroups();
         return true;
     }
 }