Skip to content

Commit

Permalink
made it so Admins are always passed through checks as Admins
Browse files Browse the repository at this point in the history
git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@777 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
Kenzaburo Ito committed Mar 14, 2002
1 parent 8c63d5f commit bc32561
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions core_user_API.php
Expand Up @@ -337,10 +337,16 @@ function access_level_check_equal( $p_access_level ) {
function access_level_check_greater_or_equal( $p_access_level ) {
global $g_string_cookie_val;

# user isn't logged in
if (( !isset( $g_string_cookie_val ) )||( empty( $g_string_cookie_val ) )) {
return false;
}

# Administrators ALWAYS pass.
if ( get_current_user_field( "access_level" ) >= ADMINISTRATOR ) {
return true;
}

$t_access_level = get_current_user_field( "access_level" );
$t_access_level2 = get_project_access_level();

Expand Down Expand Up @@ -381,6 +387,7 @@ function absolute_access_level_check_equal( $p_access_level ) {
function absolute_access_level_check_greater_or_equal( $p_access_level ) {
global $g_string_cookie_val;

# user isn't logged in
if (( !isset( $g_string_cookie_val ) ) ||
( empty( $g_string_cookie_val ) )) {
return false;
Expand All @@ -399,6 +406,10 @@ function absolute_access_level_check_greater_or_equal( $p_access_level ) {
function check_access( $p_access_level ) {
global $g_logout_page;

# Administrators ALWAYS pass.
if ( get_current_user_field( "access_level" ) >= ADMINISTRATOR ) {
return;
}
if ( !access_level_check_greater_or_equal( $p_access_level ) ) {
# need to replace with access error page
print_header_redirect( $g_logout_page );
Expand All @@ -415,6 +426,11 @@ function project_access_check( $p_bug_id, $p_project_id="0" ) {

project_check( $p_bug_id );

# Administrators ALWAYS pass.
if ( get_current_user_field( "access_level" ) >= ADMINISTRATOR ) {
return;
}

# access_level check
$t_project_id = get_bug_field( "project_id", $p_bug_id );
$t_user_id = get_current_user_field( "id" );
Expand Down

0 comments on commit bc32561

Please sign in to comment.