View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0010141 | mantisbt | filters | public | 2009-02-18 05:36 | 2023-04-17 16:16 |
Reporter | fxm | Assigned To | |||
Priority | normal | Severity | major | Reproducibility | always |
Status | feedback | Resolution | open | ||
Product Version | 1.1.6 | ||||
Summary | 0010141: Disabled users are no more liste in filter | ||||
Description | When we disable a user, it is no more possible to have its name in "Assigned To" dropdown list. This feature is very usefull just to know wich issues are still assigned to user who have no more access to Mantis. | ||||
Tags | patch | ||||
Attached Files | issue_10141.patch (7,371 bytes)
From 78c2c29efbd122a748b1606ef1f4bb9e1e20ae40 Mon Sep 17 00:00:00 2001 From: Chris Fitch <cfitch@redcom.com> Date: Fri, 30 Oct 2009 13:55:00 -0400 Subject: [PATCH] Add config option for filtering on disabled users diff --git a/config_defaults_inc.php b/config_defaults_inc.php index 4a94956..883c7f0 100644 --- a/config_defaults_inc.php +++ b/config_defaults_inc.php @@ -2940,6 +2940,13 @@ */ $g_create_short_url = 'http://tinyurl.com/create.php?url=%s'; + /** + * Included disabled users in filters + * + * @global in $g_filter_on_disabled_users + */ + $g_filter_on_disabled_users = OFF; + /************************************* * MantisBT Database Table Variables * *************************************/ diff --git a/core/filter_api.php b/core/filter_api.php index 0d887df..7915820 100644 --- a/core/filter_api.php +++ b/core/filter_api.php @@ -3428,7 +3428,7 @@ function print_filter_reporter_id() { check_selected( $t_filter[FILTER_PROPERTY_REPORTER_ID], META_FILTER_MYSELF ); echo '>[' . lang_get( 'myself' ) . ']</option>'; } - print_reporter_option_list( $t_filter[FILTER_PROPERTY_REPORTER_ID] ); + print_reporter_option_list( $t_filter[FILTER_PROPERTY_REPORTER_ID], null, (ON == config_get('filter_on_disabled_users')) ? true : false ); }?> </select> <?php @@ -3453,7 +3453,7 @@ function print_filter_user_monitor() { $t_has_project_level = access_has_project_level( $t_threshold ); if( $t_has_project_level ) { - print_reporter_option_list( $t_filter[FILTER_PROPERTY_MONITOR_USER_ID] ); + print_reporter_option_list( $t_filter[FILTER_PROPERTY_MONITOR_USER_ID], null, (ON == config_get('filter_on_disabled_users')) ? true : false ); } ?> </select> @@ -3478,7 +3478,7 @@ function print_filter_handler_id() { echo '>[' . lang_get( 'myself' ) . ']</option>'; } - print_assign_to_option_list( $t_filter[FILTER_PROPERTY_HANDLER_ID] ); + print_assign_to_option_list( $t_filter[FILTER_PROPERTY_HANDLER_ID], null, null, (ON == config_get('filter_on_disabled_users')) ? true : false ); }?> </select> <?php @@ -3870,7 +3870,7 @@ function print_filter_note_user_id() { echo '>[' . lang_get( 'myself' ) . ']</option>'; } - print_note_option_list( $t_filter[FILTER_PROPERTY_NOTE_USER_ID] ); + print_note_option_list( $t_filter[FILTER_PROPERTY_NOTE_USER_ID], null, null, (ON == config_get('filter_on_disabled_users')) ? true : false ); } ?> </select> diff --git a/core/print_api.php b/core/print_api.php index 471a1a6..cbe8d72 100644 --- a/core/print_api.php +++ b/core/print_api.php @@ -210,14 +210,14 @@ function print_captcha_input( $p_field_name ) { # This populates an option list with the appropriate users by access level # # @todo from print_reporter_option_list -function print_user_option_list( $p_user_id, $p_project_id = null, $p_access = ANYBODY ) { +function print_user_option_list( $p_user_id, $p_project_id = null, $p_access = ANYBODY, $p_show_disabled_users = false ) { $t_users = array(); if( null === $p_project_id ) { $p_project_id = helper_get_current_project(); } - $t_users = project_get_all_user_rows( $p_project_id, $p_access ); + $t_users = project_get_all_user_rows( $p_project_id, $p_access, true, $p_show_disabled_users ); # handles ALL_PROJECTS case @@ -260,8 +260,8 @@ function print_user_option_list( $p_user_id, $p_project_id = null, $p_access = A # actually reported the bugs at the time. Maybe we could get all user # who are listed as the reporter in any bug? It would probably be a # faster query actually. -function print_reporter_option_list( $p_user_id, $p_project_id = null ) { - print_user_option_list( $p_user_id, $p_project_id, config_get( 'report_bug_threshold' ) ); +function print_reporter_option_list( $p_user_id, $p_project_id = null, $p_show_disabled_users = false ) { + print_user_option_list( $p_user_id, $p_project_id, config_get( 'report_bug_threshold' ), $p_show_disabled_users ); } /** @@ -441,22 +441,22 @@ function print_news_string_by_news_id( $p_news_id ) { } # -------------------- -function print_assign_to_option_list( $p_user_id = '', $p_project_id = null, $p_threshold = null ) { +function print_assign_to_option_list( $p_user_id = '', $p_project_id = null, $p_threshold = null, $p_show_disabled_users = false ) { if( null === $p_threshold ) { $p_threshold = config_get( 'handle_bug_threshold' ); } - print_user_option_list( $p_user_id, $p_project_id, $p_threshold ); + print_user_option_list( $p_user_id, $p_project_id, $p_threshold, $p_show_disabled_users ); } -function print_note_option_list( $p_user_id = '', $p_project_id = null, $p_threshold = null ) { +function print_note_option_list( $p_user_id = '', $p_project_id = null, $p_threshold = null, $p_show_disabled_users = false ) { if( null === $p_threshold ) { $p_threshold = config_get( 'add_bugnote_threshold' ); } - print_user_option_list( $p_user_id, $p_project_id, $p_threshold ); + print_user_option_list( $p_user_id, $p_project_id, $p_threshold, $p_show_disabled_users ); } /** diff --git a/core/project_api.php b/core/project_api.php index b2aa60f..518ad8d 100644 --- a/core/project_api.php +++ b/core/project_api.php @@ -497,7 +497,7 @@ function project_get_local_user_rows( $p_project_id ) { # higher than the given value. # if the first parameter is given as 'ALL_PROJECTS', return the global access level (without # any reference to the specific project -function project_get_all_user_rows( $p_project_id = ALL_PROJECTS, $p_access_level = ANYBODY, $p_include_global_users = true ) { +function project_get_all_user_rows( $p_project_id = ALL_PROJECTS, $p_access_level = ANYBODY, $p_include_global_users = true, $p_include_disabled_users = false ) { $c_project_id = db_prepare_int( $p_project_id ); # Optimization when access_level is NOBODY @@ -568,10 +568,14 @@ function project_get_all_user_rows( $p_project_id = ALL_PROJECTS, $p_access_leve if( $p_include_global_users ) { $query = "SELECT id, username, realname, access_level FROM $t_user_table - WHERE enabled = " . db_param() . " - AND access_level $t_global_access_clause"; + WHERE access_level $t_global_access_clause"; + if ( !$p_include_disabled_users ) { + $query .= " AND enabled = " . db_param(); + $result = db_query_bound( $query, Array( $t_on ) ); + } else { + $result = db_query_bound( $query ); + } - $result = db_query_bound( $query, Array( $t_on ) ); $t_row_count = db_num_rows( $result ); for( $i = 0;$i < $t_row_count;$i++ ) { $row = db_fetch_array( $result ); @@ -585,10 +589,14 @@ function project_get_all_user_rows( $p_project_id = ALL_PROJECTS, $p_access_leve $query = "SELECT u.id, u.username, u.realname, l.access_level FROM $t_project_user_list_table l, $t_user_table u WHERE l.user_id = u.id - AND u.enabled = " . db_param() . " AND l.project_id = " . db_param(); + if ( !$p_include_disabled_users ) { + $query .= " AND u.enabled = " . db_param(); + $result = db_query_bound( $query, Array( $c_project_id, $t_on ) ); + } else { + $result = db_query_bound( $query, Array( $c_project_id ) ); + } - $result = db_query_bound( $query, Array( $t_on, $c_project_id ) ); $t_row_count = db_num_rows( $result ); for( $i = 0;$i < $t_row_count;$i++ ) { $row = db_fetch_array( $result ); -- 1.6.0.4 | ||||
has duplicate | 0008755 | closed | vboctor | disabled users are not options in user specific filters |
has duplicate | 0017092 | closed | atrol | Show inactive users in filters on "View Issues" page |
has duplicate | 0004622 | closed | atrol | Filters should have a mode that displays disabled accounts |
has duplicate | 0032394 | closed | atrol | Add filter disabled users |
related to | 0003116 | closed | dregad | If a user reports a bug, and gets purged for inactivity, updating the bug changes the username |
related to | 0008309 | closed | dregad | 'update' changes 'Reporter' and 'Assigned To' |
related to | 0007260 | new | Moving multiple issues from an obsolete user to an existing user | |
related to | 0020805 | new | Protect administrators against deleting users without understanding implications |
I have supplied a patch that adds a configuration option for showing disabled users in filter lists. This patch requires the patch for issue 0009725 be installed first. |
|
Thanks @cmfitch1 for your contribution. Here are my comments on your patch:
If you provide the updated patch, I will apply it to 1.2.x and trunk. |
|
vboctor - After reading your comments and giving it some further thought, I have some questions and comments. Is there a reason not to always include disabled users in the filter options? I made it a configuration option, but it seems like they should have been there from the start, as it is information in the database that should be available in the filters. There isn't a way to limit the options on any other filter fields (that I'm aware of). Doing this would remove the configuration variable altogether. Regardless of whether or not a configuration variable exists for the filters, I don't think it should have an effect on the report and update issue pages. I intentionally avoided displaying disabled users on these pages, as I didn't see the need for assigning issues to users that can't log in to view/update them. If this is a desired capability for some reason, I would suggest that it be written up as a separate report with a separate configuration option added to control it. The request of this report and its duplicate (0008755) was specifically to allow filtering on disabled users. Thoughts? |
|
Is there still some progress? I'm very interested in a working and complete patch :) Thx for your work so far, cmfitch1. |
|
This seems to still be a problem. It would be great to be able to filter to show issues assigned to people who are no longer active. |
|
I submitted an updated PR with these changes. I incorporated all of vboctor's suggestions except for number 4, which i still feel should be a separate report with its own configuration option. There are reasons to want to filter on disabled users, but I don't see the use case for wanting to assign, etc. to disabled users, nor does this bug ask for that capability. |
|
@cmfitch1 I stumpled across this problem today, but your PR is still open since march 2019. Sadly. Any updates? @vboctor |
|
I am really interested in this solution, I need to filter the users that have been disabled. Tks |
|