当前位置: 首页>>代码示例>>PHP>>正文


PHP AuthLdap::ldapImportGroup方法代码示例

本文整理汇总了PHP中AuthLdap::ldapImportGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP AuthLdap::ldapImportGroup方法的具体用法?PHP AuthLdap::ldapImportGroup怎么用?PHP AuthLdap::ldapImportGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AuthLdap的用法示例。


在下文中一共展示了AuthLdap::ldapImportGroup方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: doSpecificMassiveActions

 /**
  * @since version 0.84
  *
  * @see CommonDBTM::doSpecificMassiveActions()
  **/
 function doSpecificMassiveActions($input = array())
 {
     global $CFG_GLPI;
     $res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
     switch ($input['action']) {
         case "import":
         case "sync":
             if (!Session::haveRight("import_externalauth_users", 'w')) {
                 $res['nbnoright']++;
             } else {
                 if (isset($_GET['multiple_actions']) && isset($_SESSION["glpi_massiveaction"])) {
                     if ($count = count($input["item"])) {
                         $i = $input["ldap_process_count"] - $count + 1;
                         Html::createProgressBar();
                         Html::changeProgressBarPosition($i, $input["ldap_process_count"], sprintf(__('%1$s/%2$s'), $i, $input["ldap_process_count"]));
                         $key = key($input["item"]);
                         unset($input["item"][$key]);
                         if (AuthLdap::ldapImportUserByServerId(array('method' => AuthLDAP::IDENTIFIER_LOGIN, 'value' => $key), $input["mode"], $input["authldaps_id"], true)) {
                             $input['res']['ok']++;
                         } else {
                             $input['res']['ko']++;
                         }
                         if (count($input["item"])) {
                             // more to do -> redirect
                             $_SESSION['glpi_massiveaction']['POST'] = $input;
                             Html::redirect($CFG_GLPI['root_doc'] . '/front/massiveaction.php?multiple_actions=1');
                         } else {
                             // Nothing to do redirect
                             Html::changeProgressBarPosition(100, 100, __('Successful importation'));
                             $res = $input['res'];
                             $_SESSION['ldap_import']['action'] = 'show';
                         }
                     }
                 } else {
                     if (count($input['item']) > 0) {
                         $input["ldap_process_count"] = 0;
                         $input["authldaps_id"] = $_SESSION['ldap_import']['authldaps_id'];
                         $input["mode"] = $_SESSION['ldap_import']['mode'];
                         $input['res'] = array('ok' => 0, 'ko' => 0, 'noright' => 0);
                         foreach ($input['item'] as $key => $val) {
                             if ($val) {
                                 $input["ldap_process_count"]++;
                             }
                         }
                         $_SESSION['glpi_massiveaction']['POST'] = $input;
                         Html::redirect($CFG_GLPI['root_doc'] . '/front/massiveaction.php?multiple_actions=1');
                     } else {
                         $res['ko']++;
                     }
                 }
             }
             $res['REDIRECT'] = $CFG_GLPI['root_doc'] . "/front/ldap.import.php";
             break;
         case "import_group":
             $group = new Group();
             if (!Session::haveRight("user_authtype", 'w') || !$group->canGlobal('w')) {
                 $res['nbnoright']++;
             } else {
                 if (isset($_GET['multiple_actions']) && isset($_SESSION["glpi_massiveaction"])) {
                     if ($count = count($input["item"])) {
                         $i = $input["ldap_process_count"] - $count + 1;
                         Html::createProgressBar();
                         Html::changeProgressBarPosition($i, $input["ldap_process_count"], sprintf(__('%1$s/%2$s'), $i, $input["ldap_process_count"]));
                         $key = key($input["item"]);
                         unset($input["item"][$key]);
                         if (isset($input["ldap_import_entities"][$key])) {
                             $entity = $input["ldap_import_entities"][$key];
                         } else {
                             $entity = $_SESSION["glpiactive_entity"];
                         }
                         if (AuthLdap::ldapImportGroup($key, array("authldaps_id" => $input["authldaps_id"], "entities_id" => $entity, "is_recursive" => $input["ldap_import_recursive"][$key], "type" => $input["ldap_import_type"][$key]))) {
                             $input['res']['ok']++;
                         } else {
                             $input['res']['ko']++;
                         }
                         if (count($input["item"])) {
                             // more to do -> redirect
                             $_SESSION['glpi_massiveaction']['POST'] = $input;
                             Html::redirect($CFG_GLPI['root_doc'] . '/front/massiveaction.php?multiple_actions=1');
                         } else {
                             // Nothing to do redirect
                             Html::changeProgressBarPosition(100, 100, __('Successful importation'));
                             $res = $input['res'];
                             $_SESSION['ldap_import']['action'] = 'show';
                         }
                     }
                 } else {
                     if (count($input['item']) > 0) {
                         $input["ldap_process_count"] = 0;
                         $input["authldaps_id"] = $_SESSION['ldap_server'];
                         $input['res'] = array('ok' => 0, 'ko' => 0, 'noright' => 0);
                         foreach ($input['item'] as $key => $val) {
                             if ($val) {
                                 $input["ldap_process_count"]++;
                                 $input["ldap_import_entities"][$key] = $input["ldap_import_entities"][$key];
//.........这里部分代码省略.........
开发者ID:gaforeror,项目名称:glpi,代码行数:101,代码来源:authldap.class.php

示例2: processMassiveActionsForOneItemtype

 /**
  * @since version 0.85
  *
  * @see CommonDBTM::processMassiveActionsForOneItemtype()
  **/
 static function processMassiveActionsForOneItemtype(MassiveAction $ma, CommonDBTM $item, array $ids)
 {
     global $CFG_GLPI;
     $input = $ma->getInput();
     switch ($ma->getAction()) {
         case 'import_group':
             $group = new Group();
             if (!Session::haveRight("user", User::UPDATEAUTHENT) || !$group->canGlobal(UPDATE)) {
                 $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_NORIGHT);
                 $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));
                 return;
             }
             foreach ($ids as $id) {
                 if (isset($input["dn"][$id])) {
                     $group_dn = $input["dn"][$id];
                     if (isset($input["ldap_import_entities"][$id])) {
                         $entity = $input["ldap_import_entities"][$id];
                     } else {
                         $entity = $_SESSION["glpiactive_entity"];
                     }
                     // Is recursive is in the main form and thus, don't pass through
                     // zero_on_empty mechanism inside massive action form ...
                     $is_recursive = empty($input['ldap_import_recursive'][$id]) ? 0 : 1;
                     $options = array('authldaps_id' => $_SESSION['ldap_server'], 'entities_id' => $entity, 'is_recursive' => $is_recursive, 'type' => $input['ldap_import_type'][$id]);
                     if (AuthLdap::ldapImportGroup($group_dn, $options)) {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                     } else {
                         $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);
                         $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION, $group_dn));
                     }
                 }
                 // Clean history as id does not correspond to group
                 $_SESSION['glpimassiveactionselected'] = array();
             }
             return;
         case 'import':
         case 'sync':
             if (!Session::haveRight("user", User::IMPORTEXTAUTHUSERS)) {
                 $ma->itemDone($item->getType(), $ids, MassiveAction::ACTION_NORIGHT);
                 $ma->addMessage($item->getErrorMessage(ERROR_RIGHT));
                 return;
             }
             foreach ($ids as $id) {
                 if (AuthLdap::ldapImportUserByServerId(array('method' => AuthLDAP::IDENTIFIER_LOGIN, 'value' => $id), $_SESSION['ldap_import']['mode'], $_SESSION['ldap_import']['authldaps_id'], true)) {
                     $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_OK);
                 } else {
                     $ma->itemDone($item->getType(), $id, MassiveAction::ACTION_KO);
                     $ma->addMessage($item->getErrorMessage(ERROR_ON_ACTION, $id));
                 }
             }
             return;
     }
     parent::processMassiveActionsForOneItemtype($ma, $item, $ids);
 }
开发者ID:euqip,项目名称:glpi-smartcities,代码行数:59,代码来源:authldap.class.php

示例3: checkRight

checkRight('user_authtype', 'w');
commonHeader($LANG['setup'][3], $_SERVER['PHP_SELF'], "admin", "group", "ldap");
if (isset($_GET['next'])) {
    AuthLdap::ldapChooseDirectory($_SERVER['PHP_SELF']);
} else {
    if (isset($_SESSION["ldap_import"])) {
        if ($count = count($_SESSION["ldap_import"])) {
            $percent = min(100, round(100 * ($_SESSION["ldap_import_count"] - $count) / $_SESSION["ldap_import_count"], 0));
            displayProgressBar(400, $percent);
            $key = array_pop($_SESSION["ldap_import"]);
            if (isset($_SESSION["ldap_import_entities"][$key])) {
                $entity = $_SESSION["ldap_import_entities"][$key];
            } else {
                $entity = $_SESSION["glpiactive_entity"];
            }
            AuthLdap::ldapImportGroup($key, array("authldaps_id" => $_SESSION["ldap_server"], "entities_id" => $entity, "is_recursive" => $_SESSION["ldap_import_recursive"][$key], "type" => $_SESSION["ldap_import_type"][$key]));
            glpi_header($_SERVER['PHP_SELF']);
        } else {
            unset($_SESSION["ldap_import"]);
            displayProgressBar(400, 100);
            echo "<div class='center b'>" . $LANG['ocsng'][8] . "<br>";
            echo "<a href='" . $_SERVER['PHP_SELF'] . "'>" . $LANG['buttons'][13] . "</a></div>";
        }
    }
    if (isset($_POST["change_ldap_filter"])) {
        if (isset($_POST["ldap_filter"])) {
            $_SESSION["ldap_group_filter"] = $_POST["ldap_filter"];
        }
        if (isset($_POST["ldap_filter2"])) {
            $_SESSION["ldap_group_filter2"] = $_POST["ldap_filter2"];
        }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:31,代码来源:ldap.group.import.php


注:本文中的AuthLdap::ldapImportGroup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。