From 27367f1a5a455e1f67cf58307b1542f7b0ad7c6a Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 19 May 2013 21:25:26 -0400 Subject: [PATCH] Rewrite check_bug_permissions() to be a little simpler to follow. --- includes/functions.php | 38 ++++++++++++++++---------------------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/includes/functions.php b/includes/functions.php index 304bf85..6f28571 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -631,32 +631,26 @@ function check_bug_permissions($bug, $userinfo = null) $bugsys->debug('* !$bug[hidden] = ' . (int)(!$bug['hidden'])); $bugsys->debug('*** END PERMISSIONS CHECK ***'); - - if - ( - !can_perform('canviewbugs', $bug['product'], $userinfo) - OR - !( - ( - $bug['hidden'] - AND - ( - ($userinfo['userid'] == $bug['userid'] AND can_perform('canviewownhidden', $bug['product'], $userinfo)) - OR - can_perform('canviewhidden', $bug['product'], $userinfo) - ) - ) - OR - !$bug['hidden'] - ) - ) - { + + if (!can_perform('canviewbugs', $bug['product'], $userinfo)) { $bugsys->debug('*** DONE WITH REAL CALLS ***'); return false; } - + + if ($bug['hidden']) { + if (can_perform('canviewhidden', $bug['product'], $userinfo)) { + $bugsys->debug('*** DONE WITH REAL CALLS ***'); + return true; + } else if ($userinfo['userid'] == $bug['userid'] AND can_perform('canviewownhidden', $bug['product'], $userinfo)) { + $bugsys->debug('*** DONE WITH REAL CALLS ***'); + return true; + } else { + $bugsys->debug('*** DONE WITH REAL CALLS ***'); + return false; + } + } + $bugsys->debug('*** DONE WITH REAL CALLS ***'); - return true; } -- 2.43.5