本文整理汇总了PHP中Profile_User::can方法的典型用法代码示例。如果您正苦于以下问题:PHP Profile_User::can方法的具体用法?PHP Profile_User::can怎么用?PHP Profile_User::can使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Profile_User
的用法示例。
在下文中一共展示了Profile_User::can方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doSpecificMassiveActions
/**
* @see CommonDBTM::doSpecificMassiveActions()
**/
function doSpecificMassiveActions($input = array())
{
$res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
switch ($input['action']) {
case "add_user_group":
$gu = new Group_User();
return $gu->doSpecificMassiveActions($input);
case "force_user_ldap_update":
if (Session::haveRight("user", "w")) {
$ids = array();
foreach ($input["item"] as $key => $val) {
if ($val == 1) {
if ($this->getFromDB($key)) {
if ($this->fields["authtype"] == Auth::LDAP || $this->fields["authtype"] == Auth::EXTERNAL) {
if (AuthLdap::ldapImportUserByServerId(array('method' => AuthLDAP::IDENTIFIER_LOGIN, 'value' => $this->fields["name"]), 1, $this->fields["auths_id"])) {
$res['ok']++;
} else {
$res['ko']++;
}
}
} else {
$res['ko']++;
}
}
}
} else {
$res['noright']++;
}
break;
case "change_authtype":
if (!isset($input["authtype"]) || !isset($input["auths_id"])) {
return false;
}
if (Session::haveRight("user_authtype", "w")) {
$ids = array();
foreach ($input["item"] as $key => $val) {
if ($val == 1) {
$ids[] = $key;
}
}
if (User::changeAuthMethod($ids, $input["authtype"], $input["auths_id"])) {
$res['ok']++;
} else {
$res['ko']++;
}
} else {
$res['noright']++;
}
break;
case "add_userprofile":
$right = new Profile_User();
if (isset($input['profiles_id']) && $input['profiles_id'] > 0 && isset($input['entities_id']) && $input['entities_id'] >= 0) {
$input2 = array();
$input2['entities_id'] = $input['entities_id'];
$input2['profiles_id'] = $input['profiles_id'];
$input2['is_recursive'] = $input['is_recursive'];
foreach ($input["item"] as $key => $val) {
if ($val == 1) {
$input2['users_id'] = $key;
if ($right->can(-1, 'w', $input2)) {
if ($right->add($input2)) {
$res['ok']++;
} else {
$res['ko']++;
}
} else {
$res['noright']++;
}
}
}
}
break;
default:
return parent::doSpecificMassiveActions($input);
}
return $res;
}
示例2: Profile
include GLPI_ROOT . "/inc/includes.php";
$profile = new Profile();
$right = new Profile_User();
$user = new User();
if (isset($_POST["add"])) {
$right->check(-1, 'w', $_POST);
if ($right->add($_POST)) {
Event::log($_POST["users_id"], "users", 4, "setup", $_SESSION["glpiname"] . " " . $LANG['log'][61]);
}
glpi_header($_SERVER['HTTP_REFERER']);
} else {
if (isset($_POST["delete"])) {
if (isset($_POST["item"]) && count($_POST["item"])) {
foreach ($_POST["item"] as $key => $val) {
if ($val == 1) {
if ($right->can($key, 'w')) {
$right->delete(array('id' => $key));
}
}
}
if (isset($_POST["entities_id"])) {
// From entity tab
Event::log($_POST["entities_id"], "entity", 4, "setup", $_SESSION["glpiname"] . " " . $LANG['log'][62]);
} else {
if (isset($_POST["users_id"])) {
Event::log($_POST["users_id"], "users", 4, "setup", $_SESSION["glpiname"] . " " . $LANG['log'][62]);
}
}
}
glpi_header($_SERVER['HTTP_REFERER']);
} else {