fix issues from testing with #12

This commit is contained in:
Erik Hommel 2017-07-20 11:11:06 +02:00
parent 662f217570
commit 2c4c12cb56
2 changed files with 3 additions and 2 deletions

View File

@ -259,9 +259,10 @@ function civicrm_api3($entity, $action, $data) {
* Function to get the valid rest_allowed_actions key * Function to get the valid rest_allowed_actions key
* *
* @param $action * @param $action
* @param $rest_allowed_actions
* @return bool * @return bool
*/ */
function civiproxy_get_valid_allowed_actions_key($action) { function civiproxy_get_valid_allowed_actions_key($action, $rest_allowed_actions) {
$remote_addr = $_SERVER['REMOTE_ADDR']; $remote_addr = $_SERVER['REMOTE_ADDR'];
// check IP specific whitelisting if specified for this address // check IP specific whitelisting if specified for this address
if (isset($rest_allowed_actions[$remote_addr])) { if (isset($rest_allowed_actions[$remote_addr])) {

View File

@ -51,7 +51,7 @@ if (!isset($action['version']) || $action['version'] != 3) {
// the previous test is still used when no 'all' key is found in the array // the previous test is still used when no 'all' key is found in the array
if (isset($rest_allowed_actions['all'])) { if (isset($rest_allowed_actions['all'])) {
// get valid key for the rest_allowed_actions // get valid key for the rest_allowed_actions
$valid_allowed_key = civiproxy_get_valid_allowed_actions_key($action); $valid_allowed_key = civiproxy_get_valid_allowed_actions_key($action, $rest_allowed_actions);
if (isset($rest_allowed_actions[$valid_allowed_key][$action['entity']]) && isset($rest_allowed_actions[$valid_allowed_key][$action['entity']][$action['action']])) { if (isset($rest_allowed_actions[$valid_allowed_key][$action['entity']]) && isset($rest_allowed_actions[$valid_allowed_key][$action['entity']][$action['action']])) {
$valid_parameters = $rest_allowed_actions[$valid_allowed_key][$action['entity']][$action['action']]; $valid_parameters = $rest_allowed_actions[$valid_allowed_key][$action['entity']][$action['action']];