View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0011081 | mantisbt | api soap | public | 2009-10-26 11:28 | 2010-02-22 14:34 |
Reporter | KarlReichert | Assigned To | rombert | ||
Priority | normal | Severity | major | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 1.1.8 | ||||
Target Version | 1.2.0 | Fixed in Version | 1.2.0 | ||
Summary | 0011081: Username not printed correctly when failing to enter a bug via SOAP API | ||||
Description | I'm trying to integrate MantisBT into Eclipse via mantisconnect.php (SOAP API). When trying to a enter a bug using an account not allow to do that, I get an error (please see attachment). But instead of printing the real username, the internal user ID (which can be seen when editing the user table in MySQL) is printed. It would be very helpfull to have the real username printed instead, not the ID, as the ID can normally be seen only by the MySQL Administrator. | ||||
Tags | No tags attached. | ||||
Attached Files | 0001-Issue-11081-Username-not-printed-correctly-when-fail.patch (1,494 bytes)
From 8460749f5d6252e67c7b91bf4ce0af0992a03ef4 Mon Sep 17 00:00:00 2001 From: Robert Munteanu <robert.munteanu@gmail.com> Date: Fri, 30 Oct 2009 14:38:00 +0200 Subject: [PATCH] Issue #11081: Username not printed correctly when failing to enter a bug via SOAP API Adds two utility functions for reporting login failed and access denied errors. --- api/soap/mc_api.php | 27 +++++++++++++++++++++++++++ 1 files changed, 27 insertions(+), 0 deletions(-) diff --git a/api/soap/mc_api.php b/api/soap/mc_api.php index dae2345..3d105f0 100644 --- a/api/soap/mc_api.php +++ b/api/soap/mc_api.php @@ -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 ); +} -- 1.6.4.2 | ||||
If you're using the Eclipse plugin, don't you already know which user you are logged in as? |
|
Yes, I do. But when you get this error in Eclipse plugin, you want to track down the problem. And so it would be helpful to see in the error message, if the user one has configured in the plugin is really used to login. This is not the case, as only the ID is printed. Of course, with admin rights to the MySQL database, one can check, to which username the ID belongs. But it would be nice to have this already printed in the error, so one does not has to check the database and does not need admin rights to do so. |
|
This requirement makes sense. We should change all our errors to return the user names rather than the user ids. |
|
@vboctor: I'm thinking of using the functions from the attached patch, adding more when needed. How does that look to you? |
|
Fixes applied to master and master-1.2.x |
|
MantisBT: master-1.2.x 114364f6 2009-10-30 08:38 Details Diff |
Issue 0011081: Username not printed correctly when failing to enter a bug via SOAP API Adds two utility functions for reporting login failed and access denied errors. |
Affected Issues 0011081 |
|
mod - api/soap/mc_api.php | Diff File | ||
MantisBT: master 2de6c6ab 2009-10-30 08:38 Details Diff |
Issue 0011081: Username not printed correctly when failing to enter a bug via SOAP API Adds two utility functions for reporting login failed and access denied errors. |
Affected Issues 0011081 |
|
mod - api/soap/mc_api.php | Diff File | ||
MantisBT: master-1.2.x 5f52be16 2009-10-30 09:21 Details Diff |
Issue 0011081: Username not printed correctly when failing to enter a bug via SOAP API Use the new error reporting functions. |
Affected Issues 0011081 |
|
mod - api/soap/mc_file_api.php | Diff File | ||
mod - api/soap/mc_issue_api.php | Diff File | ||
mod - api/soap/mc_project_attachment_api.php | Diff File | ||
mod - api/soap/mc_project_api.php | Diff File | ||
mod - api/soap/mc_issue_attachment_api.php | Diff File | ||
mod - api/soap/mc_filter_api.php | Diff File | ||
mod - api/soap/mc_config_api.php | Diff File | ||
MantisBT: master cf703349 2009-10-30 09:21 Details Diff |
Issue 0011081: Username not printed correctly when failing to enter a bug via SOAP API Use the new error reporting functions. |
Affected Issues 0011081 |
|
mod - api/soap/mc_issue_api.php | Diff File | ||
mod - api/soap/mc_project_attachment_api.php | Diff File | ||
mod - api/soap/mc_file_api.php | Diff File | ||
mod - api/soap/mc_issue_attachment_api.php | Diff File | ||
mod - api/soap/mc_filter_api.php | Diff File | ||
mod - api/soap/mc_config_api.php | Diff File | ||
mod - api/soap/mc_project_api.php | Diff File |