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

Use the new error reporting functions.
  • Loading branch information
rombert committed Nov 1, 2009
1 parent 2de6c6a commit cf70334
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 102 deletions.
4 changes: 2 additions & 2 deletions api/soap/mc_config_api.php
Expand Up @@ -9,11 +9,11 @@
function mc_config_get_string( $p_username, $p_password, $p_config_var ) {
$t_user_id = mci_check_login( $p_username, $p_password );
if( $t_user_id === false ) {
return new soap_fault( 'Client', '', 'Access Denied' );
return mci_soap_fault_login_failed();
}

if( !mci_has_readonly_access( $t_user_id ) ) {
return new soap_fault( 'Client', '', 'Access Denied' );
return mci_soap_fault_access_denied( $t_user_id );
}

if( config_is_private( $p_config_var ) ) {
Expand Down
8 changes: 4 additions & 4 deletions api/soap/mc_file_api.php
Expand Up @@ -160,7 +160,7 @@ function mci_file_get( $p_file_id, $p_type, $p_user_id ) {
WHERE id='$p_file_id'";
break;
default:
return new soap_fault( 'Client', '', 'Access Denied' );
return new soap_fault( 'Server', '', 'Invalid file type '.$p_type. ' .' );
}

$result = db_query( $query );
Expand All @@ -184,16 +184,16 @@ function mci_file_get( $p_file_id, $p_type, $p_user_id ) {
switch( $p_type ) {
case 'bug':
if( !mci_file_can_download_bug_attachments( $t_bug_id, $p_user_id ) ) {
return new soap_fault( 'Client', '', 'Access Denied' );
return mci_soap_fault_access_denied( $t_user_id );
}
break;
case 'doc':
# Check if project documentation feature is enabled.
if( OFF == config_get( 'enable_project_documentation' ) ) {
return new soap_fault( 'Client', '', 'Access Denied' );
return mci_soap_fault_access_denied( $t_user_id );
}
if( !access_has_project_level( config_get( 'view_proj_doc_threshold' ), $t_project_id, $p_user_id ) ) {
return new soap_fault( 'Client', '', 'Access Denied' );
return mci_soap_fault_access_denied( $t_user_id );
}
break;
}
Expand Down
12 changes: 6 additions & 6 deletions api/soap/mc_filter_api.php
Expand Up @@ -17,10 +17,10 @@
function mc_filter_get( $p_username, $p_password, $p_project_id ) {
$t_user_id = mci_check_login( $p_username, $p_password );
if( $t_user_id === false ) {
return new soap_fault( 'Client', '', 'Access Denied' );
return mci_soap_fault_login_failed();
}
if( !mci_has_readonly_access( $t_user_id, $p_project_id ) ) {
return new soap_fault( 'Client', '', 'Access Denied' );
return mci_soap_fault_access_denied( $t_user_id );
}
$t_result = array();
foreach( mci_filter_db_get_available_queries( $p_project_id, $t_user_id ) as $t_filter_row ) {
Expand Down Expand Up @@ -50,10 +50,10 @@ function mc_filter_get_issues( $p_username, $p_password, $p_project_id, $p_filte
$t_user_id = mci_check_login( $p_username, $p_password );
$t_lang = mci_get_user_lang( $t_user_id );
if( $t_user_id === false ) {
return new soap_fault( 'Client', '', 'Access Denied' );
return mci_soap_fault_login_failed();
}
if( !mci_has_readonly_access( $t_user_id, $p_project_id ) ) {
return new soap_fault( 'Client', '', 'Access Denied' );
return mci_soap_fault_access_denied( $t_user_id );
}

$t_page_count = 0;
Expand Down Expand Up @@ -136,10 +136,10 @@ function mc_filter_get_issues( $p_username, $p_password, $p_project_id, $p_filte
function mc_filter_get_issue_headers( $p_username, $p_password, $p_project_id, $p_filter_id, $p_page_number, $p_per_page ) {
$t_user_id = mci_check_login( $p_username, $p_password );
if( $t_user_id === false ) {
return new soap_fault( 'Client', '', 'Access Denied' );
return mci_soap_fault_login_failed();
}
if( !mci_has_readonly_access( $t_user_id, $p_project_id ) ) {
return new soap_fault( 'Client', '', 'Access Denied' );
return mci_soap_fault_access_denied( $t_user_id );
}

$t_page_count = 0;
Expand Down

0 comments on commit cf70334

Please sign in to comment.