diff options
author | 2011-02-20 13:46:15 +0100 | |
---|---|---|
committer | 2011-02-20 13:46:15 +0100 | |
commit | 180f7a828d5484d0b3f56367352b317dfd053e5f (patch) | |
tree | 66f132a5f9982c14642bfeb5f5bee5ab2c467038 /custom_extraperms.cgi | |
parent | Add runstats.sh (diff) | |
download | bugzilla-180f7a828d5484d0b3f56367352b317dfd053e5f.tar.gz bugzilla-180f7a828d5484d0b3f56367352b317dfd053e5f.tar.bz2 bugzilla-180f7a828d5484d0b3f56367352b317dfd053e5f.zip |
Add custom_* scripts
Diffstat (limited to 'custom_extraperms.cgi')
-rwxr-xr-x | custom_extraperms.cgi | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/custom_extraperms.cgi b/custom_extraperms.cgi new file mode 100755 index 000000000..b793cb5ce --- /dev/null +++ b/custom_extraperms.cgi @@ -0,0 +1,47 @@ +#!/usr/bin/perl -wT +use strict; + +use lib qw(. lib); + +use Bugzilla; +use Bugzilla::Constants; +use Bugzilla::Error; +use Bugzilla::Util; + +my $cgi = Bugzilla->cgi; +my $dbh = Bugzilla->switch_to_shadow_db(); +my $user = Bugzilla->login(LOGIN_REQUIRED); + +my @bindValues; + +print $cgi->header(-type=>'text/html'); + +$user->in_group('admin') + || $user->in_group('editusers') + || $user->in_group('gentoo-dev') + || ThrowUserError('auth_failure', {action => 'access', object => 'administrative_pages'}); + +my $sql_archtesters = "SELECT profiles.login_name FROM profiles JOIN user_group_map ON user_id=profiles.userid JOIN groups ON groups.id=group_id WHERE user_id IN (SELECT user_id FROM user_group_map WHERE group_id=31) AND group_id != 7 AND profiles.login_name NOT LIKE '%\@gentoo.org' GROUP BY login_name ORDER BY login_name;"; +my $sql_otherperm = "SELECT profiles.login_name,groups.name AS group_name FROM profiles JOIN user_group_map ON user_id=profiles.userid JOIN groups ON groups.id=group_id WHERE user_id NOT IN (SELECT user_id FROM user_group_map WHERE group_id=31) AND group_id != 7 AND profiles.login_name NOT LIKE '%\@gentoo.org' GROUP BY login_name ORDER BY login_name;"; + +my $users; +$users = $dbh->selectall_arrayref( + $sql_archtesters, + { Slice => {} }, + @bindValues +); + +printf "<h3>Arch Testers</h3>\n"; +foreach my $row (@$users) { + printf "<a href='%scustom_userhistory.cgi?matchstr=%s'>%s</a><br />\n", correct_urlbase(), $row->{'login_name'}, $row->{'login_name'}; +} + +$users = $dbh->selectall_arrayref( + $sql_otherperm, + { Slice => {} }, + @bindValues +); +printf "<h3>Other Groups</h3>\n"; +foreach my $row (@$users) { + printf "<a href='%scustom_userhistory.cgi?matchstr=%s'>%s</a>: %s<br />\n", correct_urlbase(), $row->{'login_name'}, $row->{'login_name'}, $row->{'group_name'}; +} |