diff options
-rw-r--r-- | languages/en.php | 6 | ||||
-rw-r--r-- | services/api/rest.php | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/languages/en.php b/languages/en.php index 6d28a74dd..3fde82ee5 100644 --- a/languages/en.php +++ b/languages/en.php @@ -93,7 +93,11 @@ 'InvalidParameterException:NoDataFound' => "Could not find any data.", 'InvalidParameterException:DoesNotBelong' => "Does not belong to entity.", 'InvalidParameterException:DoesNotBelongOrRefer' => "Does not belong to entity or refer to entity.", - 'InvalidParameterException:MissingParameter' => "Missing parameter, you need to provide a GUID.",
+ 'InvalidParameterException:MissingParameter' => "Missing parameter, you need to provide a GUID.", + + 'SecurityException:APIAccessDenied' => "Sorry, API access has been disabled by the administrator.", + 'SecurityException:NoAuthMethods' => "No authentication methods were found that could authenticate this API request.", + 'APIException:ApiResultUnknown' => "API Result is of an unknown type, this should never happen.",
/**
* User details
*/
diff --git a/services/api/rest.php b/services/api/rest.php index 2944a24ff..41e44d9b2 100644 --- a/services/api/rest.php +++ b/services/api/rest.php @@ -26,7 +26,7 @@ // Check to see if the api is available if ((isset($CONFIG->disable_api)) && ($CONFIG->disable_api == true)) - throw new ConfigurationException("Sorry, API access has been disabled by the administrator."); + throw new SecurityException(elgg_echo('SecurityException:APIAccessDenied')); // Register some default PAM methods, plugins can add their own register_pam_handler('pam_auth_session'); @@ -47,11 +47,11 @@ $result = execute_method($method, $params, $token); } else - throw new SecurityException("No authentication methods were found that could authenticate this API request."); + throw new SecurityException(elgg_echo('SecurityException:NoAuthMethods')); // Finally output if (!($result instanceof GenericResult)) - throw new APIException("API Result is of an unknown type, this should never happen."); + throw new APIException(elgg_echo('APIException:ApiResultUnknown')); // Output the result page_draw($method, elgg_view("api/output", array("result" => $result))); |