Skip to content
Browse files

Fix #0011399: Deprecate $g_show_realname and use $g_show_user_realnam…

…e_threshold instead
  • Loading branch information...
1 parent 04d848b commit 5d6b1bb40ecfeffef892dbb32d215e7adff01c56 @grangeway grangeway committed
View
6 config_defaults_inc.php
@@ -861,12 +861,6 @@
$MantisConfig->show_version_dates_threshold = NOBODY;
/**
- * show users with their real name or not
- * @global int $g_show_realname
- */
-$MantisConfig->show_realname = OFF;
-
-/**
* leave off for now
* @global int $g_differentiate_duplicates
*/
View
2 core/filter_api.php
@@ -3445,7 +3445,7 @@ function print_filter_reporter_id() {
$t_username = user_get_field( $t_id, 'username' );
$t_realname = user_get_field( $t_id, 'realname' );
$t_display_name = string_attribute( $t_username );
- if(( isset( $t_realname ) ) && ( $t_realname > '' ) && ( ON == config_get( 'show_realname' ) ) ) {
+ if( ( isset( $t_realname ) ) && ( $t_realname > '' ) && ( access_has_project_level( config_get( 'show_user_realname_threshold' ) ) ) ) {
$t_display_name = string_attribute( $t_realname );
}
echo '<option value="' . $t_id . '" selected="selected">' . $t_display_name . '</option>';
View
4 core/obsolete.php
@@ -197,4 +197,6 @@
config_obsolete( 'sort_icon_arr', 'theme');
config_obsolete( 'content_expire', '' );
config_obsolete( 'page_title', 'top_include_page' );
-config_obsolete( 'icon_path', 'theme' );
+config_obsolete( 'icon_path', 'theme' );
+
+config_obsolete( 'show_realname', 'show_user_realname_threshold' );
View
2 core/print_api.php
@@ -281,7 +281,7 @@ function print_user_option_list( $p_user_id, $p_project_id = null, $p_access = A
$t_display = array();
$t_sort = array();
- $t_show_realname = ( ON == config_get( 'show_realname' ) );
+ $t_show_realname = ( access_has_project_level( config_get( 'show_user_realname_threshold', null, null, $p_project_id ) ) );
$t_sort_by_last_name = ( ON == config_get( 'sort_by_last_name' ) );
foreach( $t_users as $t_user ) {
$t_user_name = string_attribute( $t_user['username'] );
View
6 core/user_api.php
@@ -475,7 +475,7 @@ function user_get_realname( $p_user_id ) {
/**
* return the username or a string "user<id>" if the user does not exist
- * if show_realname is set and real name is not empty, return it instead
+ * if show_user_realname_threshold is set and real name is not empty, return it instead
*
* @param int $p_user_id User ID
* @return string
@@ -487,7 +487,7 @@ function user_get_name( $p_user_id ) {
return _( 'user' ) . (int) $p_user_id;
}
- if( ON == config_get( 'show_realname' ) ) {
+ if( access_has_project_level( config_get( 'show_user_realname_threshold' ) ) ) {
if( is_blank( $t_user->realname ) ) {
return $t_user->username;
} else {
@@ -797,7 +797,7 @@ function user_get_unassigned_by_project_id( $p_project_id = null ) {
$t_display = array();
$t_sort = array();
$t_users = array();
- $t_show_realname = ( ON == config_get( 'show_realname' ) );
+ $t_show_realname = ( access_has_project_level( config_get( 'show_user_realname_threshold', null, null, $p_project_id ), $p_project_id ) );
$t_sort_by_last_name = ( ON == config_get( 'sort_by_last_name' ) );
while( $t_row = db_fetch_array( $t_result ) ) {
View
2 manage/proj_edit_page.php
@@ -498,7 +498,7 @@
foreach ( $t_users as $t_user ) {
$t_user_name = string_attribute( $t_user['username'] );
$t_sort_name = mb_strtolower( $t_user_name );
- if ( ( isset( $t_user['realname'] ) ) && ( $t_user['realname'] > "" ) && ( ON == config_get( 'show_realname' ) ) ){
+ if ( ( isset( $t_user['realname'] ) ) && ( $t_user['realname'] > "" ) && ( access_has_project_level( config_get( 'show_user_realname_threshold', null, null, $f_project_id ), $f_project_id ) ) {
$t_user_name = string_attribute( $t_user['realname'] ) . " (" . $t_user_name . ")";
if ( ON == config_get( 'sort_by_last_name') ) {
$t_sort_name_bits = explode( ' ', mb_strtolower( $t_user_name ), 2 );
View
2 plugins/XmlImportExport/ImportXml/Issue.php
@@ -305,7 +305,7 @@ private function get_user_id( $p_username, $p_squash_userid = 0 ) {
$t_user_id = user_get_id_by_name( $p_username );
if( $t_user_id === false ) {
// user not found by username -> check real name
- // keep in mind that the setting config_get( 'show_realname' ) may differ between import and export system!
+ // keep in mind that the setting config_get( 'show_user_realname_threshold' ) may differ between import and export system!
$t_user_id = user_get_id_by_realname( $p_username );
if ( $t_user_id === false ) {
//not found
View
2 project_page.php
@@ -112,7 +112,7 @@
$t_access_level_for_dev_team = config_get( 'development_team_threshold' );
$t_users = project_get_all_user_rows( $f_project_id, $t_access_level_for_dev_team );
-$t_show_real_names = config_get( 'show_realname' ) == ON;
+$t_show_real_names = access_has_project_level( config_get( 'show_user_realname_threshold', null, null, $f_project_id ) );
if ( count( $t_users ) > 0 ) {
echo '<h2>', _( 'Development Team' ), '</h2>';

3 comments on commit 5d6b1bb

@dregad
Mantis Bug Tracker member

I don't think you should do that - please see my comment http://www.mantisbt.org/bugs/view.php?id=11399#c31588

@grangeway
@dregad
Mantis Bug Tracker member

Then what about view_user_page.php ?

Take the example of mantisbt.org - we work with usernames everywhere, but as developer you're allowed to see users' realnames in view_user_page.php.

With your change, 2 options

  • threshold = DEVELOPER : developers and above see realnames everywhere in the application (not what we want)
  • threshold = ADMINISTRATOR (or even NOBODY) : nobody can see realnames, except users in their own profile, and administrators in the manage user pages (also not what we want).

In both cases we lose functionality.

Please sign in to comment.
Something went wrong with that request. Please try again.