本文整理汇总了PHP中Group_User::doSpecificMassiveActions方法的典型用法代码示例。如果您正苦于以下问题:PHP Group_User::doSpecificMassiveActions方法的具体用法?PHP Group_User::doSpecificMassiveActions怎么用?PHP Group_User::doSpecificMassiveActions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Group_User
的用法示例。
在下文中一共展示了Group_User::doSpecificMassiveActions方法的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: doSpecificMassiveActions
/**
* @see CommonDBTM::doSpecificMassiveActions()
**/
function doSpecificMassiveActions($input = array())
{
$res = array('ok' => 0, 'ko' => 0, 'noright' => 0);
switch ($input['action']) {
case "add_user_group":
case "add_supervisor_group":
case "add_delegatee_group":
$gu = new Group_User();
return $gu->doSpecificMassiveActions($input);
case "changegroup":
if (isset($input["field"]) && isset($input['groups_id'])) {
foreach ($input['item'] as $type => $ids) {
if ($item = getItemForItemtype($type)) {
foreach ($ids as $id => $val) {
if ($val && $item->can($id, 'w')) {
if ($item->update(array('id' => $id, $input["field"] => $input["groups_id"]))) {
$res['ok']++;
} else {
$res['ko']++;
}
} else {
$res['noright']++;
}
}
} else {
$res['ko']++;
}
}
} else {
$res['ko']++;
}
break;
default:
return parent::doSpecificMassiveActions($input);
}
return $res;
}