Author: Christoph M. Becker (cmb69)
Committer: Derick Rethans (derickr)
Date: 2024-08-01T14:46:13+01:00

Commit: 
https://github.com/php/web-bugs/commit/4a29f1a2662413699306109ab2901283292748eb
Raw diff: 
https://github.com/php/web-bugs/commit/4a29f1a2662413699306109ab2901283292748eb.diff

GH-114: Lock down bug tracker to developers only

All further conversation about bugs is supposed to happen on Github.
We still allow developers to edit the bug tracker, so they can clean
up.

We start by disallowing users to add patches.

Changed paths:
  M  www/bug.php
  M  www/patch-add.php


Diff:

diff --git a/www/bug.php b/www/bug.php
index 7e784c33..fe196481 100644
--- a/www/bug.php
+++ b/www/bug.php
@@ -1109,7 +1109,9 @@
 <br>
 OUTPUT;
     }
-    echo "<p><a href='patch-add.php?bug_id={$bug_id}'>Add a Patch</a></p>";
+    if ($logged_in) {
+        echo "<p><a href='patch-add.php?bug_id={$bug_id}'>Add a Patch</a></p>";
+    }
 
     $pullRequestRepository = $container->get(PullRequestRepository::class);
     $pulls = $pullRequestRepository->findAllByBugId($bug_id);
diff --git a/www/patch-add.php b/www/patch-add.php
index 9429ced1..12e31add 100644
--- a/www/patch-add.php
+++ b/www/patch-add.php
@@ -16,6 +16,13 @@
 // Authenticate
 bugs_authenticate($user, $pw, $logged_in, $user_flags);
 
+if (!$logged_in) {
+    response_header('Developers only');
+    display_bug_error('Only developers are allowed to add patches');
+    response_footer();
+    exit;
+}
+
 $canpatch = true;
 
 /// Input vars

Reply via email to