r206: Allow bugs to be hidden for security reasons or if they want to look deleted.
authorRobert Sesek <rsesek@bluestatic.org>
Sun, 29 May 2005 20:44:21 +0000 (20:44 +0000)
committerRobert Sesek <rsesek@bluestatic.org>
Sun, 29 May 2005 20:44:21 +0000 (20:44 +0000)
admin/usergroup.php
docs/schema_changes.sql
editcomment.php
editreport.php
includes/init.php
index.php
showhistory.php
showreport.php
templates/default/SHOWREPORT.tpl
templates/default/editreport.tpl

index b76302704a8e2fcf6bc8370e02241a792ccda9ae..5b4efa02432aa0ce46e6fd5a07183a31a358491c 100755 (executable)
@@ -97,6 +97,7 @@ if ($_REQUEST['do'] == 'add' OR $_REQUEST['do'] == 'edit')
        $permissions = array(
                'general' => array(
                        'canviewbugs',
+                       'canviewhiddenbugs',
                        'cansearch',
                        'cansubscribe',
                        'canbeassignedto'),
index df7f777c42fbec168894113230270b5b9e83a790..90efbcb39661e6d4486040168051265b7aa79346 100644 (file)
@@ -48,4 +48,6 @@ CREATE TABLE `bugfield` (
 CREATE TABLE `bugvaluefill` (
   `bugid` INT(10) UNSIGNED NOT NULL,
   PRIMARY KEY (`bugid`)
-);
\ No newline at end of file
+);
+
+ALTER TABLE `bug` ADD `hidden` INT(2) UNSIGNED NOT NULL AFTER `assignedto`;
\ No newline at end of file
index 42f53fda714f0c3ef999f56a296a0a8d8180af6d..d94a3c2a9934d93fd38f54cf16fb4b85f0cdbb51 100644 (file)
@@ -36,6 +36,11 @@ if (!((can_perform('caneditown') AND $bugsys->userinfo['userid'] == $comment['us
        $message->error_permission();
 }
 
+if ($bug['hidden'] AND !can_perform('canviewhiddenbugs'))
+{
+       $message->error_permissison();
+}
+
 // ###################################################################
 
 if (empty($_REQUEST['do']))
index 113f4082f22755a164b1a230a5d470716be41ea9..6d492d2233cb34fc2bd46e0cbffa4caab8c493e8 100644 (file)
@@ -37,6 +37,11 @@ if (!(((can_perform('caneditown') AND $bugsys->userinfo['userid'] == $comment['u
        $message->error_permission();
 }
 
+if ($bug['hidden'] AND !can_perform('canviewhiddenbugs'))
+{
+       $message->error_permission();
+}
+
 // setup logging
 require_once('./includes/class_history.php');
 $log = new History();
@@ -94,7 +99,8 @@ if ($_POST['do'] == 'update')
                        assignedto = " . intval($bugsys->in['assignedto']) . ",
                        productid = " . $pcv['product'] . ",
                        componentid = " . $pcv['component'] . ",
-                       versionid = " . $pcv['version'] . "
+                       versionid = " . $pcv['version'] . ",
+                       hidden = " . intval($bugsys->in['hidden']) . "
                WHERE bugid = $bug[bugid]"
        );
        
index 02a352aaccad6180d4e213137dc7dbbdb5e43352..04dc26ddf2201e3ef63720bae6e768064865ea17 100755 (executable)
@@ -187,7 +187,8 @@ $_PERMISSION = array(
        'canadmintools'         => 262144, // can use admin tools
        'canadminfields'        => 524288, // can admin custom bug fields
        'canbeassignedto'       => 1048576, // can be assigned bugs,
-       'caneditattach'         => 2097152 // can edit attachments
+       'caneditattach'         => 2097152, // can edit attachments
+       'canviewhiddenbugs'     => 4194304 // can see hidden bugs
 );
 
 foreach ($_PERMISSION AS $name => $maskvalue)
index de6c01249ad3a99b7a728624e8d1c5518b83fe6b..15f1615ec00bf5028ea291982373f781caae5f4f 100644 (file)
--- a/index.php
+++ b/index.php
@@ -32,7 +32,8 @@ $bugs_fetch = $db->query("
        LEFT JOIN user AS user1
                ON (bug.userid = user1.userid)
        LEFT JOIN user AS user2
-               ON (bug.lastpostby = user2.userid)
+               ON (bug.lastpostby = user2.userid)" . ((!can_perform('canviewhiddenbugs')) ? "
+       WHERE !hidden" : "") . "
        ORDER BY bug.lastposttime DESC"
 );
 
index f3f8ec4b2b800867542f44fafdae13a0a0d502d0..665d31556fa6bddf6c03fbfbec9ac66f29a0f040 100644 (file)
@@ -24,6 +24,11 @@ if (!$bug)
        $message->error('alert: bad bug');
 }
 
+if ($bug['hidden'] AND !can_perform('canviewhiddenbugs'))
+{
+       $message->error_permission();
+}
+
 // ###################################################################
 
 $logs_fetch = $db->query("
index 50406a0754dce61a68f8227aebfdac751217e4f7..d5b12a3e0ae229b27fc8ae13789b5a137e604f32 100644 (file)
@@ -38,7 +38,12 @@ $bug = $db->query_first("
 if (!is_array($bug))
 {
        $message->error('alert: bad bug');
-}      
+}
+
+if ($bug['hidden'] AND !can_perform('canviewhiddenbugs'))
+{
+       $message->error_permission();
+}
 
 // -------------------------------------------------------------------
 // prep display
index 3f10ff40d10dd81382eab6c62b5da903b042713d..d66e0257e255793186d159d6f96a103ea7f2adba 100644 (file)
@@ -1,3 +1,5 @@
+<if condition="$bug['hidden']"><div><strong style="color: red">This bug is hidden!</strong></div></if>
+
 <div><strong>Bug ID:</strong> $bug[bugid]</div>
 <div><strong>Reported by:</strong> $bug[userinfo]</div>
 <div><strong>Product:</strong> $bug[product] <if condition="$bug['componentid']">/ <strong>Component:</strong> $bug[component]</if> / <strong>Version:</strong> $bug[version]</div>
index 2851d7664caf556afa1737c6a798783bdb51a2b7..16c6ecd6e13612c3e6c4e6bf82a353b1d5395ad1 100644 (file)
@@ -3,6 +3,7 @@
 <input type="hidden" name="bugid" value="$bug[bugid]" />
 
 <div><strong>Bug ID:</strong> $bug[bugid]</div>
+<div><strong<if condition="$bug['hidden']"> style="color: red"</if>>Hidden:</strong> <input type="checkbox" name="hidden" value="1"<if condition="$bug['hidden']"> checked="checked"</if> /></div>
 <div><strong>Summary/Title:</strong> <input type="text" name="summary" size="25" value="$bug[summary]" /></div>
 <div><strong>Severity:</strong> <select name="severity">$select[severity]</select></div>