Skip to content

Commit

Permalink
Fix error message when user can’t handle issues
Browse files Browse the repository at this point in the history
The access denied reason was passed in instead of user id, causing error message
to show user id of 0 and no reason.  The fix was to pass the user id then reason.

Also changed reason messages to not re-reference the user id, but just focus on reason.

Messages will look as follows:
`Access denied for vboctor.  Reason: User does not have access right to handle issues.`

Fixes #22762
  • Loading branch information
vboctor committed Apr 30, 2017
1 parent c56bfd5 commit 05977c0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions api/soap/mc_issue_api.php
Expand Up @@ -679,18 +679,18 @@ function mc_issue_get_id_from_summary( $p_username, $p_password, $p_summary ) {
*/
function mci_issue_handler_access_check( $p_user_id, $p_project_id, $p_old_handler_id, $p_new_handler_id ) {
if( $p_new_handler_id != 0 ) {
if ( !user_exists( $p_new_handler_id ) ) {
if( !user_exists( $p_new_handler_id ) ) {
return ApiObjectFactory::faultNotFound( 'User \'' . $p_new_handler_id . '\' does not exist.' );
}

if( !access_has_project_level( config_get( 'handle_bug_threshold' ), $p_project_id, $p_new_handler_id ) ) {
return mci_fault_access_denied( 'User \'' . $p_new_handler_id . '\' does not have access right to handle issues' );
return mci_fault_access_denied( $p_new_handler_id, 'User does not have access right to handle issues' );
}
}

if( $p_old_handler_id != $p_new_handler_id ) {
if( !access_has_project_level( config_get( 'update_bug_assign_threshold' ), $p_project_id, $p_user_id ) ) {
return mci_fault_access_denied( 'User \'' . $p_user_id . '\' does not have access right to assign issues' );
return mci_fault_access_denied( $p_user_id, 'User does not have access right to assign issues' );
}
}

Expand Down Expand Up @@ -763,7 +763,7 @@ function mc_issue_add( $p_username, $p_password, $p_issue ) {
}

if( !access_has_project_level( config_get( 'report_bug_threshold' ), $t_project_id, $t_user_id ) ) {
return mci_fault_access_denied( 'User \'' . $t_user_id . '\' does not have access right to report issues' );
return mci_fault_access_denied( $t_user_id, 'User \'' . user_get_name( $t_user_id ) . '\' does not have access right to report issues' );
}

$t_access_check_result = mci_issue_handler_access_check( $t_user_id, $t_project_id, /* old */ 0, /* new */ $t_handler_id );
Expand Down

0 comments on commit 05977c0

Please sign in to comment.