? bug_change_status_page.php Index: bug_actiongroup.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/bug_actiongroup.php,v retrieving revision 1.32 diff -u -r1.32 bug_actiongroup.php --- bug_actiongroup.php 24 Jul 2004 11:48:33 -0000 1.32 +++ bug_actiongroup.php 1 Aug 2004 23:01:48 -0000 @@ -59,7 +59,7 @@ case 'COPY': $f_project_id = gpc_get_int( 'project_id' ); - if ( access_has_project_level( config_get( 'report_bug_threshold' ), $f_project_id ) ) { + if ( access_has_project_level( access_get_status_threshold( NEW_ ), $f_project_id ) ) { bug_copy( $t_bug_id, $f_project_id ); } else { $t_failed_ids[] = $t_bug_id; Index: bug_report.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/bug_report.php,v retrieving revision 1.33 diff -u -r1.33 bug_report.php --- bug_report.php 1 Aug 2004 22:24:58 -0000 1.33 +++ bug_report.php 1 Aug 2004 23:01:48 -0000 @@ -23,7 +23,7 @@ require_once( $t_core_path.'custom_field_api.php' ); ?> - + status ) ?> - + status ) ?> 1 month'; Index: core/access_api.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/access_api.php,v retrieving revision 1.30 diff -u -r1.30 access_api.php --- core/access_api.php 27 Jul 2004 14:24:57 -0000 1.30 +++ core/access_api.php 1 Aug 2004 23:01:49 -0000 @@ -128,17 +128,11 @@ #=================================== # -------------------- - # Check the current user's access against the given value and return true - # if the user's access is equal to or higher, false otherwise. + # Get the current user's access # # This function only checks the user's global access level, ignoring any # overrides they might have at a project level - function access_has_global_level( $p_access_level, $p_user_id = null ) { - # Short circuit the check in this case - if ( NOBODY == $p_access_level ) { - return false; - } - + function access_get_global_level( $p_user_id = null ) { if ( $p_user_id === null ) { $p_user_id = auth_get_current_user_id(); } @@ -150,7 +144,24 @@ return false; } - $t_access_level = user_get_field( $p_user_id, 'access_level' ); + return user_get_field( $p_user_id, 'access_level' ); + } + + # -------------------- + # Check the current user's access against the given value and return true + # if the user's access is equal to or higher, false otherwise. + # + function access_has_global_level( $p_access_level, $p_user_id = null ) { + # Short circuit the check in this case + if ( NOBODY == $p_access_level ) { + return false; + } + + if ( $p_user_id === null ) { + $p_user_id = auth_get_current_user_id(); + } + + $t_access_level = access_get_global_level( $p_user_id ); return ( $t_access_level >= $p_access_level ); } @@ -165,23 +176,17 @@ } # -------------------- - # Check the current user's access against the given value and return true - # if the user's access is equal to or higher, false otherwise. + # Get the current user's access level # # This function checks the project access level first (for the current project # if none is specified) and if the user is not listed, it falls back on the # user's global access level. - function access_has_project_level( $p_access_level, $p_project_id = null, $p_user_id = null ) { - # Short circuit the check in this case - if ( NOBODY == $p_access_level ) { - return false; - } - + function access_get_project_level( $p_project_id = null, $p_user_id = null ) { # Deal with not logged in silently in this case # @@@ we may be able to remove this and just error # and once we default to anon login, we can remove it for sure if ( !auth_is_user_authenticated() ) { - return false; + return ANYBODY; } if ( null === $p_user_id ) { @@ -193,11 +198,11 @@ } if ( ALL_PROJECTS == $p_project_id ) { - return access_has_global_level( $p_access_level, $p_user_id ); + $t_access_level = access_get_global_level( $p_user_id ); + }else{ + $t_access_level = access_get_local_level( $p_user_id, $p_project_id ); } - $t_access_level = access_get_local_level( $p_user_id, $p_project_id ); - # Try to use the project access level. # If the user is not listed in the project, then try to fall back # to the global access level @@ -213,6 +218,28 @@ } } + return $t_access_level; + } + + # -------------------- + # Check the current user's access against the given value and return true + # if the user's access is equal to or higher, false otherwise. + # + function access_has_project_level( $p_access_level, $p_project_id = null, $p_user_id = null ) { + # Short circuit the check in this case + if ( NOBODY == $p_access_level ) { + return false; + } + + if ( null === $p_user_id ) { + $p_user_id = auth_get_current_user_id(); + } + if ( null === $p_project_id ) { + $p_project_id = helper_get_current_project(); + } + + $t_access_level = access_get_project_level( $p_project_id, $p_user_id ); + return ( $t_access_level >= $p_access_level ); } @@ -310,7 +337,7 @@ return true; } - return access_has_bug_level( config_get( 'close_bug_threshold' ), $p_bug_id, $p_user_id ); + return access_has_bug_level( access_get_status_threshold( CLOSED ), $p_bug_id, $p_user_id ); } # -------------------- @@ -352,6 +379,8 @@ # Data Access #=================================== + # get the user's access level specific to this project. + # return false (0) if the user has no access override here function access_get_local_level( $p_user_id, $p_project_id ) { $p_project_id = (int)$p_project_id; # 000001 is different from 1. @@ -363,4 +392,21 @@ return false; } } + + # -------------------- + # get the access level required to change the issue to the new status + # If there is no specific differentiated access level, use the + # generic update_bug_status_threshold + function access_get_status_threshold( $p_status, $p_project_id=ALL_PROJECTS ) { + + $t_default_level = config_get( 'update_bug_status_threshold' ); + $t_thresh_array = config_get( 'set_status_threshold' ); + if ( isset( $t_thresh_array[ $p_status ] ) ) { + return $t_thresh_array[ $p_status ]; + }else{ + return $t_default_level; + } + } + + ?> \ No newline at end of file Index: core/filter_api.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/filter_api.php,v retrieving revision 1.53 diff -u -r1.53 filter_api.php --- core/filter_api.php 31 Jul 2004 13:16:38 -0000 1.53 +++ core/filter_api.php 1 Aug 2004 23:01:50 -0000 @@ -46,7 +46,7 @@ $t_project_table = config_get( 'mantis_project_table' ); $t_bug_monitor_table = config_get( 'mantis_bug_monitor_table' ); $t_limit_reporters = config_get( 'limit_reporters' ); - $t_report_bug_threshold = config_get( 'report_bug_threshold' ); + $t_report_bug_threshold = access_get_status_threshold( NEW_ ); if ( $custom_filter == null ) { $t_filter = current_user_get_bug_filter(); @@ -119,7 +119,7 @@ foreach( $t_filter['reporter_id'] as $t_filter_member ) { $c_reporter_id = db_prepare_int( $t_filter_member ); if ( META_FILTER_MYSELF == $c_reporter_id ) { - if ( access_has_project_level( config_get( 'report_bug_threshold' ) ) ) { + if ( access_has_project_level( access_get_status_threshold( NEW_ ) ) ) { $c_reporter_id = auth_get_current_user_id(); array_push( $t_clauses, "($t_bug_table.reporter_id='$c_reporter_id')" ); } @@ -741,7 +741,7 @@ if ( ( $t_current == 0 ) || ( is_blank( $t_current ) ) ) { $t_any_found = true; } else if ( META_FILTER_MYSELF == $t_current ) { - if ( access_has_project_level( config_get( 'report_bug_threshold' ) ) ) { + if ( access_has_project_level( access_get_status_threshold( NEW_ ) ) ) { $t_this_name = '[' . lang_get( 'myself' ) . ']'; } else { $t_any_found = true; Index: core/html_api.php =================================================================== RCS file: /cvsroot/mantisbt/mantisbt/core/html_api.php,v retrieving revision 1.115 diff -u -r1.115 html_api.php --- core/html_api.php 1 Aug 2004 08:56:38 -0000 1.115 +++ core/html_api.php 1 Aug 2004 23:01:51 -0000 @@ -249,7 +249,6 @@ $t_access_level = get_enum_element( 'access_levels', current_user_get_access_level() ); $t_now = date( config_get( 'complete_date_format' ) ); $t_realname = current_user_get_field( 'realname' ); - PRINT ''; PRINT ''; PRINT '