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


PHP Group_User::can方法代码示例

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


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

示例1: foreach

     $user->check($_POST['id'], 'w');
     $user->update($_POST);
     Event::log(0, "users", 5, "setup", $_SESSION["glpiname"] . "  " . $LANG['log'][21] . "  " . $user->fields["name"] . ".");
     glpi_header($_SERVER['HTTP_REFERER']);
 } else {
     if (isset($_POST["addgroup"])) {
         $groupuser->check(-1, 'w', $_POST);
         if ($groupuser->add($_POST)) {
             Event::log($_POST["users_id"], "users", 4, "setup", $_SESSION["glpiname"] . " " . $LANG['log'][48]);
         }
         glpi_header($_SERVER['HTTP_REFERER']);
     } else {
         if (isset($_POST["deletegroup"])) {
             if (count($_POST["item"])) {
                 foreach ($_POST["item"] as $key => $val) {
                     if ($groupuser->can($key, 'w')) {
                         $groupuser->delete(array('id' => $key));
                     }
                 }
             }
             Event::log($_POST["users_id"], "users", 4, "setup", $_SESSION["glpiname"] . " " . $LANG['log'][49]);
             glpi_header($_SERVER['HTTP_REFERER']);
         } else {
             if (isset($_POST["change_auth_method"])) {
                 checkRight('user_authtype', 'w');
                 $user->check($_POST['id'], 'w');
                 if (isset($_POST["auths_id"])) {
                     User::changeAuthMethod(array($_POST["id"]), $_POST["authtype"], $_POST["auths_id"]);
                 }
                 glpi_header($_SERVER['HTTP_REFERER']);
             } else {
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:31,代码来源:user.form.php

示例2: sprintf

     $user->check($_POST['id'], UPDATE);
     $user->update($_POST);
     Event::log($_POST['id'], "users", 5, "setup", sprintf(__('%s updates an item'), $_SESSION["glpiname"]));
     Html::back();
 } else {
     if (isset($_POST["addgroup"])) {
         $groupuser->check(-1, CREATE, $_POST);
         if ($groupuser->add($_POST)) {
             Event::log($_POST["users_id"], "users", 4, "setup", sprintf(__('%s adds a user to a group'), $_SESSION["glpiname"]));
         }
         Html::back();
     } else {
         if (isset($_POST["deletegroup"])) {
             if (count($_POST["item"])) {
                 foreach ($_POST["item"] as $key => $val) {
                     if ($groupuser->can($key, DELETE)) {
                         $groupuser->delete(array('id' => $key));
                     }
                 }
             }
             Event::log($_POST["users_id"], "users", 4, "setup", sprintf(__('%s deletes users from a group'), $_SESSION["glpiname"]));
             Html::back();
         } else {
             if (isset($_POST["change_auth_method"])) {
                 Session::checkRight('user', User::UPDATEAUTHENT);
                 if (isset($_POST["auths_id"])) {
                     User::changeAuthMethod(array($_POST["id"]), $_POST["authtype"], $_POST["auths_id"]);
                 }
                 Html::back();
             } else {
                 if (isset($_GET["ext_auth"])) {
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:31,代码来源:user.form.php

示例3: foreach

     $inst = new Computer_SoftwareVersion();
     foreach ($_POST["item"] as $key => $val) {
         if ($val == 1) {
             $comp = new Computer();
             if ($comp->getFromDB($key) && $comp->fields["entities_id"] == $_SESSION["glpiactive_entity"]) {
                 $inst->add(array('computers_id' => $key, 'softwareversions_id' => $_POST["softwareversions_id"]));
             }
         }
     }
     break;
 case "add_group":
     $groupuser = new Group_User();
     foreach ($_POST["item"] as $key => $val) {
         if ($val == 1) {
             $input = array('groups_id' => $_POST["groups_id"], 'users_id' => $key);
             if ($groupuser->can(-1, 'w', $input)) {
                 $groupuser->add($input);
             }
         }
     }
     break;
 case "add_userprofile":
     $right = new Profile_User();
     if (isset($_POST['profiles_id']) && $_POST['profiles_id'] > 0 && isset($_POST['entities_id']) && $_POST['entities_id'] >= 0) {
         $input['entities_id'] = $_POST['entities_id'];
         $input['profiles_id'] = $_POST['profiles_id'];
         $input['is_recursive'] = $_POST['is_recursive'];
         foreach ($_POST["item"] as $key => $val) {
             if ($val == 1) {
                 $input['users_id'] = $key;
                 $right->add($input);
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:31,代码来源:massiveaction.php


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