fix issues from testing with #12
This commit is contained in:
parent
662f217570
commit
2c4c12cb56
|
|
@ -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])) {
|
||||||
|
|
|
||||||
|
|
@ -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']];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue