/** * This method modifies an existing user. Undefined fields do not change * and defined fields with a NULL value also remain unchanged. * * @access public * * @param OA_Dll_UserInfo $oUser * <b>For adding</b><br /> * <b>Required properties:</b> contactName, emailAddress, defaultAccountId<br /> * <b>Optional properties:</b> username, password (both depending on the authentication type)<br /> * * <b>For modify</b><br /> * <b>Required properties:</b> userId<br /> * <b>Optional properties:</b> contactName, emailAddress, defaultAccountId, password (depending on the authentication type)<br /> * * @return success boolean True if the operation was successful * */ function modify(&$oUser) { if (!isset($oUser->userId)) { // Add $oUser->setDefaultForAdd(); } if (!$this->checkPermissions(OA_ACCOUNT_ADMIN)) { return false; } $userData = (array) $oUser; // Name $userData['contact_name'] = $oUser->contactName; $userData['email_address'] = $oUser->emailAddress; $userData['default_account_id'] = $oUser->defaultAccountId; // Add a reference for username and password, they might be modified during validation $userData['username'] =& $oUser->username; $userData['password'] =& $oUser->password; if ($this->_validate($oUser)) { $doUser = OA_Dal::factoryDO('users'); if (!isset($userData['userId'])) { $doUser->setFrom($userData); $oUser->userId = $doUser->insert(); if ($oUser->userId) { if (!OA_Permission::setAccountAccess($oUser->defaultAccountId, $oUser->userId)) { $this->raiseError(self::ERROR_COULD_NOT_LINK_USER_TO_DEFAULT_ACC); return false; } } } else { $doUser->get($userData['userId']); $doUser->setFrom($userData); $doUser->update(); } return true; } else { return false; } }
/** * This method returns a list of users by Account ID. * * @param int $accountId * * @return array array OA_Dll_UserInfo objects */ function getUserListByAccountId($accountId) { $dataUserList = $this->_sendWithSession('ox.getUserListByAccountId', array((int) $accountId)); $returnData = array(); foreach ($dataUserList as $dataUser) { $oUserInfo = new OA_Dll_UserInfo(); $oUserInfo->readDataFromArray($dataUser); $returnData[] = $oUserInfo; } return $returnData; }