Skip to content

Commit

Permalink
Issue #11081: Username not printed correctly when failing to enter a …
Browse files Browse the repository at this point in the history
…bug via SOAP API

Adds two utility functions for reporting login failed and
access denied errors.
  • Loading branch information
rombert committed Nov 1, 2009
1 parent 94f40e2 commit 2de6c6a
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions api/soap/mc_api.php
Expand Up @@ -436,3 +436,30 @@ function error_get_stack_trace() {

return $t_trace;
}

/**
* Returns a soap_fault signalling corresponding to a failed login
* situation
*
* @return soap_fault
*/
function mci_soap_fault_login_failed() {
return new soap_fault('Client', '', 'Access denied.');
}

/**
* Returns a soap_fault signalling that the user does not have
* access rights for the specific action.
*
* @param int $p_user_id a valid user id
* @param string $p_detail The optional details to append to the error message
* @return soap_fault
*/
function mci_soap_fault_access_denied( $p_user_id, $p_detail = '' ) {
$t_user_name = user_get_name( $p_user_id );
$t_reason = 'Access denied for user '. $t_user_name . '.';
if ( !is_blank( $p_detail ))
$t_reason .= ' Reason: ' . $p_detail . '.';

return new soap_fault( 'Client', '', $t_reason );
}

0 comments on commit 2de6c6a

Please sign in to comment.