Rubber-stamped by Brady Eidson.
[webbrowser.git] / BugsSite / admin.cgi
blob6c78e0a7db392d8423416a5cf83a7bd4625a69be
1 #!/usr/bin/env perl -wT
2 # -*- Mode: perl; indent-tabs-mode: nil -*-
4 # The contents of this file are subject to the Mozilla Public
5 # License Version 1.1 (the "License"); you may not use this file
6 # except in compliance with the License. You may obtain a copy of
7 # the License at http://www.mozilla.org/MPL/
9 # Software distributed under the License is distributed on an "AS
10 # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
11 # implied. See the License for the specific language governing
12 # rights and limitations under the License.
14 # The Original Code is the Bugzilla Bug Tracking System.
16 # The Initial Developer of the Original Code is Frédéric Buclin.
17 # Portions created by Frédéric Buclin are Copyright (C) 2007
18 # Frédéric Buclin. All Rights Reserved.
20 # Contributor(s): Frédéric Buclin <LpSolit@gmail.com>
22 use strict;
24 use lib qw(. lib);
26 use Bugzilla;
27 use Bugzilla::Constants;
28 use Bugzilla::Error;
30 my $cgi = Bugzilla->cgi;
31 my $template = Bugzilla->template;
32 my $user = Bugzilla->login(LOGIN_REQUIRED);
34 print $cgi->header();
36 $user->in_group('admin')
37 || $user->in_group('tweakparams')
38 || $user->in_group('editusers')
39 || $user->can_bless
40 || (Bugzilla->params->{'useclassification'} && $user->in_group('editclassifications'))
41 || $user->in_group('editcomponents')
42 || scalar(@{$user->get_products_by_permission('editcomponents')})
43 || $user->in_group('creategroups')
44 || $user->in_group('editkeywords')
45 || $user->in_group('bz_canusewhines')
46 || ThrowUserError('auth_failure', {action => 'access', object => 'administrative_pages'});
48 $template->process('admin/admin.html.tmpl')
49 || ThrowTemplateError($template->error());