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


PHP OA_Permission::storeUserAccountsPermissions方法代码示例

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


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

示例1: linkUserToAccount

 /**
  * Links a user to an account.
  *
  * @param int $userId
  * @param int $accountId
  * @param array $aPermissions array of permissions to set (see OA_Permission.) eg:
  *                            array(OA_PERM_SUPER_ACCOUNT, OA_PERM_BANNER_EDIT)
  * @param array $aAllowedPermissions array of permissions that are allowed to be set.
  *                                   Confusingly, the array format is different from
  *                                   $aPermissions in that the permission is set in the
  *                                   array key. The array value is not used and should be set to true. eg:
  *                                   array(OA_PERM_SUPER_ACCOUNT => true, OA_PERM_BANNER_EDIT => true)
  * @return boolean true on successful linking, false otherwise.
  */
 private function linkUserToAccount($userId, $accountId, $aPermissions = null, $aAllowedPermissions = null)
 {
     if (!$this->checkPermissions(OA_ACCOUNT_ADMIN)) {
         return false;
     }
     if (!$this->checkIdExistence('users', $userId)) {
         $this->raiseError(self::ERROR_UNKNOWN_USER_ID);
         return false;
     }
     $result = OA_Permission::setAccountAccess($accountId, $userId);
     if (PEAR::isError($result)) {
         $this->raiseError($result->getMessage());
         return false;
     }
     if (!empty($aPermissions)) {
         $result = OA_Permission::storeUserAccountsPermissions($aPermissions, $accountId, $userId, $aAllowedPermissions);
         if (PEAR::isError($result)) {
             $this->raiseError($result->getMessage());
             return false;
         }
     }
     return true;
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:37,代码来源:User.php

示例2: modify

 /**
  * This method modifies an existing agency. Undefined fields do not change
  * and defined fields with a NULL value also remain unchanged.
  *
  * @access public
  *
  * @param OA_Dll_AgencyInfo &$oAgency <br />
  *          <b>For adding</b><br />
  *          <b>Required properties:</b> agencyName<br />
  *          <b>Optional properties:</b> contactName, emailAddress, username, password<br />
  *
  *          <b>For modify</b><br />
  *          <b>Required properties:</b> agencyId<br />
  *          <b>Optional properties:</b> agencyName, contactName, emailAddress<br />
  *
  * @return boolean  True if the operation was successful
  *
  */
 function modify(&$oAgency)
 {
     if (!$this->checkPermissions(OA_ACCOUNT_ADMIN)) {
         return false;
     }
     $agencyData = (array) $oAgency;
     // Name
     $agencyData['name'] = $oAgency->agencyName;
     // Default fields
     $agencyData['contact'] = $oAgency->contactName;
     $agencyData['email'] = $oAgency->emailAddress;
     if ($this->_validate($oAgency)) {
         $doAgency = OA_Dal::factoryDO('agency');
         if (!isset($agencyData['agencyId'])) {
             $doAgency->setFrom($agencyData);
             $oAgency->agencyId = $doAgency->insert();
             if ($oAgency->agencyId) {
                 // Set the account ID
                 $doAgency = OA_Dal::staticGetDO('agency', $oAgency->agencyId);
                 $oAgency->accountId = (int) $doAgency->account_id;
             }
             if (isset($agencyData['username']) || isset($agencyData['userEmail'])) {
                 // Use the authentication plugin to create the user
                 $oPlugin = OA_Auth::staticGetAuthPlugin();
                 $userId = $oPlugin->getMatchingUserId($agencyData['userEmail'], $agencyData['username']);
                 $userId = $oPlugin->saveUser($userId, $agencyData['username'], $agencyData['password'], $agencyData['contactName'], $agencyData['userEmail'], $agencyData['language'], $oAgency->accountId);
                 if ($userId) {
                     // Link the user and give permission to create new accounts
                     $aAllowedPermissions = array(OA_PERM_SUPER_ACCOUNT => 'This string intentionally left blank. WTF?');
                     $aPermissions = array(OA_PERM_SUPER_ACCOUNT);
                     OA_Permission::setAccountAccess($oAgency->accountId, $userId);
                     OA_Permission::storeUserAccountsPermissions($aPermissions, $oAgency->accountId, $userId, $aAllowedPermissions);
                 }
             }
         } else {
             $doAgency->get($agencyData['agencyId']);
             $doAgency->setFrom($agencyData);
             $doAgency->update();
         }
         return true;
     } else {
         return false;
     }
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:62,代码来源:Agency.php

示例3: _setAccountsAndPermissions

 function _setAccountsAndPermissions($userId, $accountPermissions)
 {
     foreach ($accountPermissions as $accountId => $aPermissions) {
         OA_Permission::setAccountAccess($accountId, $userId);
         OA_Permission::storeUserAccountsPermissions($aPermissions, $accountId, $userId);
     }
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:7,代码来源:Users.dal.test.php

示例4: linkUserToAccount

 /**
  * Links user with account and set apropriate messages.
  * Common method reused across user access pages
  *
  * @param integer $userId  User ID
  * @param integer $accountId  Account ID
  * @param array $permissions Array of permissions
  * @param array $aAllowedPermissions  Array of allowed permissions
  */
 function linkUserToAccount($userId, $accountId, $permissions, $aAllowedPermissions)
 {
     if (!empty($userId)) {
         if (!OA_Permission::isUserLinkedToAccount($accountId, $userId)) {
             OA_Session::setMessage($GLOBALS['strUserLinkedToAccount']);
         } else {
             OA_Session::setMessage($GLOBALS['strUserAccountUpdated']);
         }
         OA_Permission::setAccountAccess($accountId, $userId);
         OA_Permission::storeUserAccountsPermissions($permissions, $accountId, $userId, $aAllowedPermissions);
     }
 }
开发者ID:villos,项目名称:tree_admin,代码行数:21,代码来源:UserAccess.php


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