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


PHP Groups::addUserToGroup方法代码示例

本文整理汇总了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;

        }

    }
开发者ID:nhenderson,项目名称:processmaker,代码行数:91,代码来源:class.wsBase.php

示例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']);
开发者ID:emildev35,项目名称:processmaker,代码行数:30,代码来源:groups_SaveAddUser.php

示例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'];
开发者ID:ralpheav,项目名称:processmaker,代码行数:31,代码来源:groups_Ajax.php

示例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;
     }
 }
开发者ID:emildev35,项目名称:processmaker,代码行数:33,代码来源:User.php


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