diff options
Diffstat (limited to 'extensions/Dashboard/lib/Util.pm')
-rw-r--r-- | extensions/Dashboard/lib/Util.pm | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/extensions/Dashboard/lib/Util.pm b/extensions/Dashboard/lib/Util.pm new file mode 100644 index 0000000..02c80bf --- /dev/null +++ b/extensions/Dashboard/lib/Util.pm @@ -0,0 +1,31 @@ +# -*- Mode: perl; indent-tabs-mode: nil -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# Copyright (C) 2013 Jolla Ltd. +# Contact: Pami Ketolainen <pami.ketolainen@jollamobile.com> + +package Bugzilla::Extension::Dashboard::Util; +use strict; +use warnings; +use base qw(Exporter); + +our @EXPORT = qw( + user_can_access_dashboard +); + +use Bugzilla; +use Bugzilla::Error; + +sub user_can_access_dashboard { + my ($throwerror) = @_; + my $ingroup = Bugzilla->user->in_group( + Bugzilla->params->{dashboard_user_group}); + + ThrowUserError("dashboard_access_denied") if ($throwerror && !$ingroup); + return $ingroup; +} + +1; |