From e5164f3eff5adebb42bf63a8423beaed422ce7f6 Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Tue, 21 Jul 2009 16:07:27 +0000 Subject: Bug 505390: Make Bugzilla (and thus the WebService) throw an error when you try to add a private comment but aren't an insider. Patch by Max Kanat-Alexander r=LpSolit, a=LpSolit --- Bugzilla/Bug.pm | 7 ++++--- Bugzilla/WebService/Bug.pm | 7 +++++++ Bugzilla/WebService/Constants.pm | 2 ++ 3 files changed, 13 insertions(+), 3 deletions(-) mode change 100755 => 100644 Bugzilla/WebService/Bug.pm mode change 100755 => 100644 Bugzilla/WebService/Constants.pm (limited to 'Bugzilla') diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index 8b140e92f..9b0bac1e1 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -1192,9 +1192,10 @@ sub _check_comment { sub _check_commentprivacy { my ($invocant, $comment_privacy) = @_; - my $insider_group = Bugzilla->params->{"insidergroup"}; - return ($insider_group && Bugzilla->user->in_group($insider_group) - && $comment_privacy) ? 1 : 0; + if ($comment_privacy && !Bugzilla->user->is_insider) { + ThrowUserError('user_not_insider'); + } + return $comment_privacy ? 1 : 0; } sub _check_comment_type { diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm old mode 100755 new mode 100644 index e88db0773..48e554f16 --- a/Bugzilla/WebService/Bug.pm +++ b/Bugzilla/WebService/Bug.pm @@ -1536,6 +1536,10 @@ The id you specified doesn't exist in the database. You did not have the necessary rights to edit the bug. +=item 113 (Can't Make Private Comments) + +You tried to add a private comment, but don't have the necessary rights. + =back =item B @@ -1546,6 +1550,9 @@ You did not have the necessary rights to edit the bug. =item Modified to return the new comment's id in Bugzilla B<3.4> +=item Modified to throw an error if you try to add a private comment +but can't, in Bugzilla B<3.4>. + =back =back diff --git a/Bugzilla/WebService/Constants.pm b/Bugzilla/WebService/Constants.pm old mode 100755 new mode 100644 index 83b4197aa..260ae9478 --- a/Bugzilla/WebService/Constants.pm +++ b/Bugzilla/WebService/Constants.pm @@ -87,6 +87,8 @@ use constant WS_ERROR_CODE => { # See Also errors bug_url_invalid => 112, bug_url_too_long => 112, + # Insidergroup Errors + user_not_insider => 113, # Authentication errors are usually 300-400. invalid_username_or_password => 300, -- cgit v1.2.3-24-g4f1b