summaryrefslogtreecommitdiffstats
path: root/extensions/BMO
diff options
context:
space:
mode:
authorDavid Lawrence <dkl@mozilla.com>2015-09-02 08:40:56 +0200
committerByron Jones <glob@mozilla.com>2015-09-02 08:40:56 +0200
commit3d463f780fd2051751f276f71e27bb47e96dc2aa (patch)
tree26c7c6f2e745dc2ace396396ed03c7ef8c8f3b7e /extensions/BMO
parente1c42c8fcdf74f5a810aae1384808b635cdc51a4 (diff)
downloadbugzilla-3d463f780fd2051751f276f71e27bb47e96dc2aa.tar.gz
bugzilla-3d463f780fd2051751f276f71e27bb47e96dc2aa.tar.xz
Bug 1196618 - add support for group owners
Diffstat (limited to 'extensions/BMO')
-rw-r--r--extensions/BMO/lib/Reports/Groups.pm20
-rw-r--r--extensions/BMO/template/en/default/pages/group_admins.html.tmpl13
-rw-r--r--extensions/BMO/template/en/default/pages/group_members.html.tmpl8
3 files changed, 27 insertions, 14 deletions
diff --git a/extensions/BMO/lib/Reports/Groups.pm b/extensions/BMO/lib/Reports/Groups.pm
index 3a5cd75dd..d1da19c5a 100644
--- a/extensions/BMO/lib/Reports/Groups.pm
+++ b/extensions/BMO/lib/Reports/Groups.pm
@@ -34,8 +34,8 @@ sub admins_report {
my $groups = join(',', map { $dbh->quote($_) } @grouplist);
my $query = "
- SELECT groups.name, " .
- $dbh->sql_group_concat('profiles.login_name', "','", 1) . "
+ SELECT groups.id, " .
+ $dbh->sql_group_concat('profiles.userid', "','", 1) . "
FROM groups
LEFT JOIN user_group_map
ON user_group_map.group_id = groups.id
@@ -48,14 +48,18 @@ sub admins_report {
GROUP BY groups.name";
my @groups;
- foreach my $group (@{ $dbh->selectall_arrayref($query) }) {
+ foreach my $row (@{ $dbh->selectall_arrayref($query) }) {
+ my $group = Bugzilla::Group->new({ id => shift @$row, cache => 1});
my @admins;
- if ($group->[1]) {
- foreach my $admin (split(/,/, $group->[1])) {
- push(@admins, Bugzilla::User->new({ name => $admin }));
+ if (my $admin_ids = shift @$row) {
+ foreach my $uid (split(/,/, $admin_ids)) {
+ push(@admins, Bugzilla::User->new({ id => $uid, cache => 1 }));
}
}
- push(@groups, { name => $group->[0], admins => \@admins });
+ push(@groups, { name => $group->name,
+ description => $group->description,
+ owner => $group->owner,
+ admins => \@admins });
}
$vars->{'groups'} = \@groups;
@@ -197,7 +201,7 @@ sub members_report {
$group = '' unless grep { $_ eq $group } @group_names;
return if $group eq '';
my $group_obj = Bugzilla::Group->new({ name => $group });
- $vars->{'group'} = $group;
+ $vars->{'group'} = $group_obj;
my @types;
my $members = $group_obj->members_complete();
diff --git a/extensions/BMO/template/en/default/pages/group_admins.html.tmpl b/extensions/BMO/template/en/default/pages/group_admins.html.tmpl
index 01bb744c4..c81c95748 100644
--- a/extensions/BMO/template/en/default/pages/group_admins.html.tmpl
+++ b/extensions/BMO/template/en/default/pages/group_admins.html.tmpl
@@ -28,14 +28,23 @@
<table border="0" cellspacing="0" id="report" class="hover" width="100%">
<tr id="report-header">
<th align="left">Name</th>
+ <th align="left">Owner</th>
<th align="left">Admins</th>
</tr>
[% FOREACH group = groups %]
[% count = loop.count() %]
<tr class="report_item [% count % 2 == 1 ? "report_row_odd" : "report_row_even" %]">
- <td>
- [% group.name FILTER html %]
+ <td nowrap>
+ <span title="[% group.description FILTER html %]">
+ [% group.name FILTER html %]</span>
+ </td>
+ <td nowrap>
+ [% IF group.owner.login == 'nobody@mozilla.org' %]
+ &ndash;
+ [% ELSE %]
+ [% INCLUDE global/user.html.tmpl who = group.owner %]
+ [% END %]
</td>
<td>
[% FOREACH admin = group.admins %]
diff --git a/extensions/BMO/template/en/default/pages/group_members.html.tmpl b/extensions/BMO/template/en/default/pages/group_members.html.tmpl
index 98679c1b7..b1f9b82c5 100644
--- a/extensions/BMO/template/en/default/pages/group_members.html.tmpl
+++ b/extensions/BMO/template/en/default/pages/group_members.html.tmpl
@@ -21,7 +21,7 @@
<select name="group">
[% FOREACH group_name = groups %]
<option value="[% group_name FILTER html %]"
- [% "selected" IF group_name == group %]>
+ [% "selected" IF group_name == group.name %]>
[% group_name FILTER html %]</option>
[% END %]
</select>
@@ -39,7 +39,7 @@
[% IF group != '' %]
<p>
- [% count FILTER none %] member[% count == 1 ? '' : 's' %] of the <b>[% group FILTER html %]</b> group:
+ [% count FILTER none %] member[% count == 1 ? '' : 's' %] of the <b>[% group.name FILTER html %]</b> group:
</p>
[% IF types.size > 0 %]
@@ -48,7 +48,7 @@
<th>Type</th>
<th>Count</th>
<th>Members</th>
- [% IF privileged %]
+ [% IF privileged || (user.id == group.owner.id) %]
<th class="right">2FA, Last Seen (days ago)</th>
[% END %]
</tr>
@@ -111,7 +111,7 @@
[% END %]
</table>
- <a href="page.cgi?id=group_members.json&amp;group=[% group FILTER uri %]
+ <a href="page.cgi?id=group_members.json&amp;group=[% group.name FILTER uri %]
[% IF include_disabled %]&amp;include_disabled=1[% END %]">JSON</a>
[% ELSE %]
<p>