View Issue Details

IDProjectCategoryView StatusLast Update
0010141mantisbtfilterspublic2019-04-07 13:31
Reporterfxm Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status feedbackResolutionopen 
Product Version1.1.6 
Summary0010141: 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.

Tagspatch

Relationships

has duplicate 0008755 closedvboctor disabled users are not options in user specific filters 
has duplicate 0017092 closedatrol Show inactive users in filters on "View Issues" page 
has duplicate 0004622 closedatrol Filters should have a mode that displays disabled accounts 
related to 0003116 acknowledged If a user reports a bug, and gets purged for inactivity, updating the bug changes the username 
related to 0008309 confirmed '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 

Activities

cmfitch1

cmfitch1

2009-10-30 13:59

reporter  

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

issue_10141.patch (7,371 bytes)   
cmfitch1

cmfitch1

2009-10-30 14:02

reporter   ~0023500

Last edited: 2009-10-30 14:03

View 2 revisions

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.

vboctor

vboctor

2009-11-01 02:19

manager   ~0023514

Thanks @cmfitch1 for your contribution. Here are my comments on your patch:

  1. I think showing of disabled user should be ON by default. See related bugs for reasons why this may be a good idea. If users don't want to show them, then they should move issues to someone else and then delete them OR turn the configuration option OFF.

  2. Please update the docbook documentation to include documentation for the new configuration variable.

  3. The new configuration variable should be named $g_show_disabled_users.

  4. The configuration option should affect the showing of disabled users in filters, update issue, report issue, etc.

  5. Disabled users shouldn't receive emails or be able to login. This is the case at the moment, and hence your patch doesn't change that. -- no work here.

  6. (ON == config_get('filter_on_disabled_users')) ? true : false --- there is no need for the "? true : false" part. The == operation will return a boolean.

  7. "( ON == config_get( 'show_disabled_users' ) )" -- notice the spacing standard here?

If you provide the updated patch, I will apply it to 1.2.x and trunk.

cmfitch1

cmfitch1

2009-11-02 11:15

reporter   ~0023543

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?

crazya

crazya

2011-05-03 07:48

reporter   ~0028738

Is there still some progress?

I'm very interested in a working and complete patch :)

Thx for your work so far, cmfitch1.

samwilson

samwilson

2015-02-16 20:20

reporter   ~0048850

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.

cmfitch1

cmfitch1

2018-12-09 18:39

reporter   ~0061062

Last edited: 2018-12-10 04:06

View 3 revisions

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.

Issue History

Date Modified Username Field Change
2009-02-18 05:36 fxm New Issue
2009-10-30 13:59 cmfitch1 File Added: issue_10141.patch
2009-10-30 14:02 cmfitch1 Note Added: 0023500
2009-10-30 14:03 cmfitch1 Note Edited: 0023500 View Revisions
2009-10-30 23:29 vboctor Tag Attached: patch
2009-11-01 02:09 vboctor Relationship added has duplicate 0008755
2009-11-01 02:11 vboctor Relationship added related to 0003116
2009-11-01 02:12 vboctor Relationship added related to 0008309
2009-11-01 02:13 vboctor Relationship added related to 0007260
2009-11-01 02:19 vboctor Note Added: 0023514
2009-11-01 02:19 vboctor Status new => feedback
2009-11-02 11:15 cmfitch1 Note Added: 0023543
2011-05-03 07:48 crazya Note Added: 0028738
2014-03-14 15:21 atrol Relationship added has duplicate 0017092
2015-02-16 20:20 samwilson Note Added: 0048850
2015-02-17 00:03 testbha File Added: chess.jpg
2015-02-17 02:17 atrol File Deleted: chess.jpg
2015-03-02 08:04 vitsaadmin Issue cloned: 0019442
2016-04-13 04:20 atrol Relationship added related to 0020805
2016-06-14 02:15 atrol Relationship added has duplicate 0004622
2018-12-09 18:39 cmfitch1 Note Added: 0061062
2018-12-09 18:39 cmfitch1 Note Edited: 0061062 View Revisions
2018-12-10 04:06 dregad Note Edited: 0061062 View Revisions