View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0011290 | mantisbt | feature | public | 2009-12-16 08:07 | 2015-01-15 05:10 |
Reporter | RoboDoc | Assigned To | dregad | ||
Priority | normal | Severity | minor | Reproducibility | N/A |
Status | closed | Resolution | fixed | ||
Target Version | 1.3.0-beta.1 | Fixed in Version | 1.3.0-beta.1 | ||
Summary | 0011290: Create Clone access to reporters | ||||
Description | Users with "reporter" access can submit issues. It would be great if these users also could use the "Create Clone" feature, instead of having to open XX "Report Issue"-forms, copy & paste data from a previously submitted issue, just to make a similar (but not identical), new issue. | ||||
Tags | No tags attached. | ||||
Attached Files | 0001-Allow-Reporters-to-Clone-issues.patch (2,549 bytes)
From 9b50cec4b181ec553f740e4b788a2a1729167938 Mon Sep 17 00:00:00 2001 From: Damien Regad <damien.regad@merckgroup.com> Date: Mon, 9 Jan 2012 18:43:39 +0100 Subject: [PATCH] Allow Reporters to Clone issues Previously, users needed to have update_bug_threshold to be able to clone issues, since the creation of a relationship with the parent bug requires to update it. This patch lets Reporters clone issues, but disables the "Relationship with the parent issue" field in bug_report_page.php when the user does not have updater access to the parent bug. Fixes #11290 --- bug_report_page.php | 9 +++------ core/html_api.php | 4 ++-- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/bug_report_page.php b/bug_report_page.php index c1b5252..494a144 100644 --- a/bug_report_page.php +++ b/bug_report_page.php @@ -55,9 +55,6 @@ $t_bug = bug_get( $f_master_bug_id, true ); - # the user can at least update the master bug (needed to add the relationship)... - access_ensure_bug_level( config_get( 'update_bug_threshold', null, null, $t_bug->project_id ), $f_master_bug_id ); - #@@@ (thraxisp) Note that the master bug is cloned into the same project as the master, independent of # what the current project is set to. if( $t_bug->project_id != helper_get_current_project() ) { @@ -210,7 +207,7 @@ </tr> <?php } - + if ( $tpl_show_eta ) { ?> @@ -226,7 +223,7 @@ </tr> <?php } - + if ( $tpl_show_severity ) { ?> <tr <?php echo helper_alternate_class() ?>> @@ -510,7 +507,7 @@ </td> </tr> <?php //Relationship (in case of cloned bug creation...) - if( $f_master_bug_id > 0 ) { + if( $f_master_bug_id > 0 && access_has_bug_level( config_get( 'update_bug_threshold' ), $f_master_bug_id ) ) { ?> <tr <?php echo helper_alternate_class() ?>> <td class="category"> diff --git a/core/html_api.php b/core/html_api.php index ee239bb..0bbcbb3 100644 --- a/core/html_api.php +++ b/core/html_api.php @@ -1514,12 +1514,12 @@ function html_button_bug_move( $p_bug_id ) { } /** - * Print a button to move the given bug to a different project + * Print a button to clone the given bug * @param int $p_bug_id * @return null */ function html_button_bug_create_child( $p_bug_id ) { - if( access_has_bug_level( config_get( 'update_bug_threshold' ), $p_bug_id ) ) { + if( access_has_bug_level( config_get( 'report_bug_threshold' ), $p_bug_id ) ) { html_button( string_get_bug_report_url(), lang_get( 'create_child_bug_button' ), array( 'm_id' => $p_bug_id ) ); } } -- 1.7.5.4 11290-allow-reporter-close-option1-v2.patch (3,508 bytes)
diff --git a/bug_report.php b/bug_report.php index e451ff8..b3617be 100644 --- a/bug_report.php +++ b/bug_report.php @@ -35,7 +35,10 @@ form_security_validate( 'bug_report' ); $t_project_id = null; + $f_master_bug_id = gpc_get_int( 'm_id', 0 ); + $f_rel_type = gpc_get_int( 'rel_type', BUG_REL_NONE ); + if ( $f_master_bug_id > 0 ) { bug_ensure_exists( $f_master_bug_id ); if ( bug_is_readonly( $f_master_bug_id ) ) { @@ -43,9 +46,9 @@ trigger_error( ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR ); } $t_master_bug = bug_get( $f_master_bug_id, true ); - project_ensure_exists( $t_master_bug->project_id ); - access_ensure_bug_level( config_get( 'update_bug_threshold', null, null, $t_master_bug->project_id ), $f_master_bug_id ); $t_project_id = $t_master_bug->project_id; + project_ensure_exists( $t_project_id ); + access_ensure_bug_level( config_get( 'update_bug_threshold', null, null, $t_project_id ), $f_master_bug_id ); } else { $f_project_id = gpc_get_int( 'project_id' ); project_ensure_exists( $f_project_id ); @@ -168,9 +171,6 @@ } } - $f_master_bug_id = gpc_get_int( 'm_id', 0 ); - $f_rel_type = gpc_get_int( 'rel_type', -1 ); - if ( $f_master_bug_id > 0 ) { # it's a child generation... let's create the relationship and add some lines in the history @@ -181,7 +181,7 @@ history_log_event_special( $t_bug_id, BUG_CREATED_FROM, '', $f_master_bug_id ); history_log_event_special( $f_master_bug_id, BUG_CLONED_TO, '', $t_bug_id ); - if ( $f_rel_type >= 0 ) { + if ( $f_rel_type > BUG_REL_ANY ) { # Add the relationship relationship_add( $t_bug_id, $f_master_bug_id, $f_rel_type ); diff --git a/bug_report_page.php b/bug_report_page.php index 4108ae8..42e9cc6 100644 --- a/bug_report_page.php +++ b/bug_report_page.php @@ -55,9 +55,6 @@ $t_bug = bug_get( $f_master_bug_id, true ); - # the user can at least update the master bug (needed to add the relationship)... - access_ensure_bug_level( config_get( 'update_bug_threshold', null, null, $t_bug->project_id ), $f_master_bug_id ); - #@@@ (thraxisp) Note that the master bug is cloned into the same project as the master, independent of # what the current project is set to. if( $t_bug->project_id != helper_get_current_project() ) { @@ -210,7 +207,7 @@ </tr> <?php } - + if ( $tpl_show_eta ) { ?> @@ -226,7 +223,7 @@ </tr> <?php } - + if ( $tpl_show_severity ) { ?> <tr <?php echo helper_alternate_class() ?>> @@ -524,7 +521,7 @@ </td> </tr> <?php //Relationship (in case of cloned bug creation...) - if( $f_master_bug_id > 0 ) { + if( $f_master_bug_id > 0 && access_has_bug_level( config_get( 'update_bug_threshold' ), $f_master_bug_id ) ) { ?> <tr <?php echo helper_alternate_class() ?>> <td class="category"> diff --git a/core/html_api.php b/core/html_api.php index 30347c5..2be87b1 100644 --- a/core/html_api.php +++ b/core/html_api.php @@ -1517,12 +1517,12 @@ function html_button_bug_move( $p_bug_id ) { } /** - * Print a button to move the given bug to a different project + * Print a button to clone the given bug * @param int $p_bug_id * @return null */ function html_button_bug_create_child( $p_bug_id ) { - if( access_has_bug_level( config_get( 'update_bug_threshold' ), $p_bug_id ) ) { + if( access_has_bug_level( config_get( 'report_bug_threshold' ), $p_bug_id ) ) { html_button( string_get_bug_report_url(), lang_get( 'create_child_bug_button' ), array( 'm_id' => $p_bug_id ) ); } } | ||||
This would be VERY useful for "repetitive work"-purposes, e.g. Parent: "Update BIND on all name servers" And yes; we use MantisBT for other stuff than code bugtracking, as well; [simple] project management, systems maintenance, logistics, tracking non-code-related bugs, etc. :-) |
|
It seems that UPDATER access is needed (re. "update_bug_threshold"), but it should be sufficient with REPORTER access for this operation. |
|
This behavior is by design, as cloning an issue will allow the user to create a relationship to the parent issue, which will be updated by doing so. That being said, your suggestion makes sense. Please consider these 2 alternatives:
In that case, to be consistent with access rights, the "Relationship with the parent issue" field in bug_report_page.php should be disabled when the user does not have updater access to the parent bug. See attached: 11290-allow-reporter-close-option1-v2.patch
With that new setup, we could treat the bug cloning as a special case in which it is acceptable for a Reporter to update a bug they would normally not be allowed to change; however, since that change is very limited and controlled in nature (i.e. creating a new relationship), this may be acceptable. I recommend to go for option 1, which is more respectful of the access rights. Please test and let me know your thoughts. If you think option 2 is necessary, I'll bounce it off the other devs to see what they think. EDIT: revised patch (old one was missing modification of access check in bug_report.php) |
|
Pretty much a duplicate of one of my tickets: 0013323. The solution I went for is more like your option 2. |
|
Following a discussion on the mailing list [1] a new option was identified
Even though strictly speaking that should be considered as an update of the parent bug, this would probably be acceptable in the limited context of cloning and would avoid adding a new config option. [1] http://thread.gmane.org/gmane.comp.bug-tracking.mantis.devel/3799 |
|
See PR
Option 2 not implemented at this stage |
|
Implemented option 3 (Allow a user without update_bug_threshold to add relationship to parent) |
|
MantisBT: master 8aafaaf4 2014-02-05 02:51 Details Diff |
Allow Reporters to Clone issues Previously, users needed to have update_bug_threshold to be able to clone issues, since the creation of a relationship with the parent bug requires to update it. This patch lets Reporters clone issues and allows them to create a relationship with the parent, even if they lack updater access. Fixes 0011290 (implements option 3) |
Affected Issues 0011290 |
|
mod - bug_report.php | Diff File | ||
mod - bug_report_page.php | Diff File | ||
mod - core/html_api.php | Diff File |