本文整理汇总了PHP中Groups::addUserToGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP Groups::addUserToGroup方法的具体用法?PHP Groups::addUserToGroup怎么用?PHP Groups::addUserToGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Groups
的用法示例。
在下文中一共展示了Groups::addUserToGroup方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: assignUserToGroup
/**
* assigns a user to a group
*
* @param string $userId
* @param string $groupId
* @return $result will return an object
*/
public function assignUserToGroup ($userId, $groupId)
{
try {
global $RBAC;
$RBAC->initRBAC();
$user = $RBAC->verifyUserId( $userId );
if ($user == 0) {
$result = new wsResponse( 3, G::loadTranslation( 'ID_USER_NOT_REGISTERED_SYSTEM' ) );
return $result;
}
$groups = new Groups();
$very_group = $groups->verifyGroup( $groupId );
if ($very_group == 0) {
$result = new wsResponse( 9, G::loadTranslation( 'ID_GROUP_NOT_REGISTERED_SYSTEM' ) );
return $result;
}
$very_user = $groups->verifyUsertoGroup( $groupId, $userId );
if ($very_user == 1) {
$result = new wsResponse( 8, G::loadTranslation( 'ID_USER_ALREADY_EXISTS_GROUP' ) );
return $result;
}
$groups->addUserToGroup( $groupId, $userId );
$result = new wsResponse( 0, G::loadTranslation( 'ID_COMMAND_EXECUTED_SUCCESSFULY' ) );
return $result;
} catch (Exception $e) {
$result = new wsResponse( 100, $e->getMessage() );
return $result;
}
}
示例2: Groups
<?php
/**
* groups_SaveAddUser.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
if (($RBAC_Response = $RBAC->userCanAccess("PM_USERS")) != 1) {
return $RBAC_Response;
}
G::LoadClass('groups');
$groups = new Groups();
$groups->addUserToGroup($_GET['GRP_UID'], $_POST['form']['USR_UID']);
示例3: array
$oCriteria->setLimit($limit);
$oDataset = UsersPeer::doSelectRS($oCriteria);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$arrData = array();
while ($oDataset->next()) {
$arrData[] = $oDataset->getRow();
}
echo '{success: true, members: ' . G::json_encode($arrData) . ', total_users: ' . $totalRows . '}';
break;
case 'assignUsersToGroupsMultiple':
$GRP_UID = $_POST['GRP_UID'];
$uUIDs = explode(',', $_POST['USR_UID']);
G::LoadClass('groups');
$oGroup = new Groups();
foreach ($uUIDs as $USR_UID) {
$oGroup->addUserToGroup($GRP_UID, $USR_UID);
}
break;
case 'deleteUsersToGroupsMultiple':
$GRP_UID = $_POST['GRP_UID'];
$uUIDs = explode(',', $_POST['USR_UID']);
G::LoadClass('groups');
$oGroup = new Groups();
foreach ($uUIDs as $USR_UID) {
$oGroup->removeUserOfGroup($GRP_UID, $USR_UID);
}
break;
case 'updatePageSize':
G::LoadClass('configuration');
$c = new Configurations();
$arr['pageSize'] = $_REQUEST['size'];
示例4: create
/**
* Assign User to Group
*
* @param string $groupUid Unique id of Group
* @param array $arrayData Data
*
* return array Return data of the User assigned to Group
*/
public function create($groupUid, $arrayData)
{
try {
$arrayData = array_change_key_case($arrayData, CASE_UPPER);
unset($arrayData["GRP_UID"]);
//Verify data
$process = new \ProcessMaker\BusinessModel\Process();
$group = new \ProcessMaker\BusinessModel\Group();
$group->throwExceptionIfNotExistsGroup($groupUid, $this->arrayFieldNameForException["groupUid"]);
$process->throwExceptionIfDataNotMetFieldDefinition($arrayData, $this->arrayFieldDefinition, $this->arrayFieldNameForException, true);
$process->throwExceptionIfNotExistsUser($arrayData["USR_UID"], $this->arrayFieldNameForException["userUid"]);
$this->throwExceptionIfExistsGroupUser($groupUid, $arrayData["USR_UID"], $this->arrayFieldNameForException["userUid"]);
//Create
$group = new \Groups();
$group->addUserToGroup($groupUid, $arrayData["USR_UID"]);
//Return
$arrayData = array_merge(array("GRP_UID" => $groupUid), $arrayData);
if (!$this->formatFieldNameInUppercase) {
$arrayData = array_change_key_case($arrayData, CASE_LOWER);
}
return $arrayData;
} catch (\Exception $e) {
throw $e;
}
}