View Issue Details

IDProjectCategoryView StatusLast Update
0011923mantisbtotherpublic2014-09-23 18:05
Reporteratrol Assigned Todregad  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.2.1 
Target Version1.2.9Fixed in Version1.2.9 
Summary0011923: Wrong display of user's access level in notes
Description

After an issue is moved from projekt A to B the display of access level in notes is (@0@) if the user who added to note has no rights for the new project.

Steps To Reproduce
  1. Create private projects A and B
  2. Assign user U1 to project A, U2 to A and B
  3. Enter issue as user U1 in project A
  4. Add a note to the issue
  5. As user U2 move issue from project A to B

Result: Display of access level in note right beside username U1 is (@0@)

Additional Information

Seems that this piece of code is the problem
bugnote_view_inc.php
$t_access_level = access_get_project_level( null, (int)$t_bugnote->reporter_id );
echo '(', get_enum_element( 'access_levels', $t_access_level ), ')';

if I undertand right, the returnvalue of access_get_project_level will be ANYBODY (=0) in this case
and get_enum_element( 'access_levels', 0 ) delivers (@0@)

Adding a value for 0 in access_levels would certainly fix this problem, but maybe will have unwanted side effects.

Possibly this is at least a workaround:
Introduce a new function access_get_project_level_string which delivers something like lang_get( 'access_level_anybody_string' ) for input value ANYBODY and the enum element for all other values.

More clean?: ANYBODY access level is introduced system wide, so that every user is per default ANYBODY and has ANYBODY access level for private projects. (which means has no rights)

TagsNo tags attached.
Attached Files
11923-bugnote-access_level-0.patch (1,075 bytes)   
From a746e1d434882be3775c9a4722aed2ee40781e16 Mon Sep 17 00:00:00 2001
From: Lapinkiller <lapinkiller@hotmail.fr>
Date: Thu, 28 Jul 2011 14:33:14 +0200
Subject: [PATCH] bugnote access_level=0 mantis#11923

---
 bugnote_view_inc.php |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/bugnote_view_inc.php b/bugnote_view_inc.php
index 9332839..0f65440 100644
--- a/bugnote_view_inc.php
+++ b/bugnote_view_inc.php
@@ -119,8 +119,12 @@ $num_notes = count( $t_bugnotes );
 		<span class="small"><?php
 			if ( user_exists( $t_bugnote->reporter_id ) ) {
 				$t_access_level = access_get_project_level( null, (int)$t_bugnote->reporter_id );
-				echo '(', get_enum_element( 'access_levels', $t_access_level ), ')';
+				//No label if access_level is 0
+				if($t_access_level>0 && $t_access_level){
+					echo '(', get_enum_element( 'access_levels', $t_access_level ), ')';
+				}
 			}
+			
 		?></span>
 		<?php if ( VS_PRIVATE == $t_bugnote->view_state ) { ?>
 		<span class="small">[ <?php echo lang_get( 'private' ) ?> ]</span>
-- 
1.7.6.msysgit.0

Relationships

related to 0015721 closedgrangeway Functionality to consider porting to master-2.0.x 
has duplicate 0012512 closedatrol Access level of user in bugnote view when user is removed from project 

Activities

dhx

dhx

2010-11-04 08:46

reporter   ~0027243

Good catch, I'll fix this shortly.

Lapinkiller

Lapinkiller

2011-07-28 08:26

reporter   ~0029312

Last edited: 2011-07-28 08:37

On my installation i have already fix it. There is the same problem when an user have been removed from project, in this case, i don't show the inexistent "@0@" access level

patch attached, i cannot submit a push from git because of this f**** proxy :@

atrol

atrol

2011-07-28 09:35

developer   ~0029313

Thanks for your contribution
Would be fine to get patches following our coding conventions
http://www.mantisbt.org/guidelines.php

dregad

dregad

2011-12-03 16:59

developer   ~0030465

Lapinkiller, I have applied your patch to 1.2.x and master, with some minor changes and a more descriptive commit message.

Thanks for your contribution !

grangeway

grangeway

2013-04-05 17:57

reporter   ~0036329

Marking as 'acknowledged' not resolved/closed to track that change gets ported to master-2.0.x branch

Related Changesets

MantisBT: master b41fe484

2011-07-28 01:33

Lapinkiller


Details Diff
Fix 0011923: incorrect display of access level in notes

Do not display the access level in bugnotes when it is 0 (ANYBODY).

Prior to this, the access level display in bugnotes was (@0@) if the
user who added the note did not have access to the project. This
situation can happen when an issue is moved to a private project, or
when a user's rights to a private project are revoked.

Signed-off-by: Damien Regad <damien.regad@merckgroup.com>
Affected Issues
0011923
mod - bugnote_view_inc.php Diff File

MantisBT: master-1.2.x 23ef2964

2011-07-28 01:33

Lapinkiller


Details Diff
Fix 0011923: incorrect display of access level in notes

Do not display the access level in bugnotes when it is 0 (ANYBODY).

Prior to this, the access level display in bugnotes was (@0@) if the
user who added the note did not have access to the project. This
situation can happen when an issue is moved to a private project, or
when a user's rights to a private project are revoked.

Signed-off-by: Damien Regad <damien.regad@merckgroup.com>
Affected Issues
0011923
mod - bugnote_view_inc.php Diff File