From 5dd270a16c7a6caea49740b16fc5495dd8d9c036 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Wed, 18 Apr 2012 16:11:26 -0700 Subject: Bug 744092: filter security bugcounts on describe-keywords --- describekeywords.cgi | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'describekeywords.cgi') diff --git a/describekeywords.cgi b/describekeywords.cgi index 9796b77d5..b8ed9bb48 100755 --- a/describekeywords.cgi +++ b/describekeywords.cgi @@ -38,7 +38,17 @@ my $vars = {}; # Run queries against the shadow DB. Bugzilla->switch_to_shadow_db; -$vars->{'keywords'} = Bugzilla::Keyword->get_all_with_bug_count(); +# Hide bug counts for security keywords from users who aren't a member of the +# security group +my $can_see_security = Bugzilla->user->in_group('security-group'); +my $keywords = Bugzilla::Keyword->get_all_with_bug_count(); +foreach my $keyword (@$keywords) { + $keyword->{'bug_count'} = 0 + if $keyword->name =~ /^(?:sec|csec|wsec|opsec)-/ + && !$can_see_security; +} + +$vars->{'keywords'} = $keywords; $vars->{'caneditkeywords'} = Bugzilla->user->in_group("editkeywords"); print Bugzilla->cgi->header(); -- cgit v1.2.3-24-g4f1b