View Issue Details

IDProjectCategoryView StatusLast Update
0010141mantisbtfilterspublic2023-04-17 16:16
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
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

issue_10141.patch (7,371 bytes)   

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 
has duplicate 0032394 closedatrol Add filter disabled users 
related to 0003116 closeddregad If a user reports a bug, and gets purged for inactivity, updating the bug changes the username 
related to 0008309 closeddregad '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 14:02

reporter   ~0023500

Last edited: 2009-10-30 14:03

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

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.

keessonnema

keessonnema

2020-11-06 07:21

reporter   ~0064614

@cmfitch1 I stumpled across this problem today, but your PR is still open since march 2019. Sadly. Any updates? @vboctor

borismartinez20

borismartinez20

2023-04-17 16:16

reporter   ~0067669

I am really interested in this solution, I need to filter the users that have been disabled.
Is there any progress or someone who can help me?

Tks