summaryrefslogtreecommitdiffstats
path: root/extensions/BMO/lib/Reports
diff options
context:
space:
mode:
authorByron Jones <glob@mozilla.com>2015-09-01 07:01:20 +0200
committerByron Jones <glob@mozilla.com>2015-09-01 07:01:20 +0200
commit421ff7f194875db9634ea783d9dd5b6111f19df3 (patch)
tree5806e9f3001fa4f33ba85aa94856b70a7f878cf8 /extensions/BMO/lib/Reports
parentbcc93f83a64a76cd73501eaefaf5fd073fbc3f0d (diff)
downloadbugzilla-421ff7f194875db9634ea783d9dd5b6111f19df3.tar.gz
bugzilla-421ff7f194875db9634ea783d9dd5b6111f19df3.tar.xz
Bug 1197073 - add support for 2fa using totp (eg. google authenticator)
Diffstat (limited to 'extensions/BMO/lib/Reports')
-rw-r--r--extensions/BMO/lib/Reports/Groups.pm30
1 files changed, 19 insertions, 11 deletions
diff --git a/extensions/BMO/lib/Reports/Groups.pm b/extensions/BMO/lib/Reports/Groups.pm
index 4a831fab3..3a5cd75dd 100644
--- a/extensions/BMO/lib/Reports/Groups.pm
+++ b/extensions/BMO/lib/Reports/Groups.pm
@@ -174,10 +174,12 @@ sub members_report {
action => 'run',
object => 'group_admins' });
- my @grouplist =
- ($user->in_group('editusers') || $user->in_group('infrasec'))
- ? map { lc($_->name) } Bugzilla::Group->get_all
- : _get_public_membership_groups();
+ my $privileged = $user->in_group('editusers') || $user->in_group('infrasec');
+ $vars->{privileged} = $privileged;
+
+ my @grouplist = $privileged
+ ? map { lc($_->name) } Bugzilla::Group->get_all
+ : _get_public_membership_groups();
my $include_disabled = $cgi->param('include_disabled') ? 1 : 0;
$vars->{'include_disabled'} = $include_disabled;
@@ -240,20 +242,26 @@ sub members_report {
if ($page eq 'group_members.json') {
my %users;
foreach my $rh (@types) {
- my $group_name = $rh->{name} eq '_direct' ? 'direct' : $rh->{name};
foreach my $member (@{ $rh->{members} }) {
my $login = $member->login;
if (exists $users{$login}) {
- push @{ $users{$login}->{groups} }, $group_name;
+ push @{ $users{$login}->{groups} }, $rh->{name} if $privileged;
}
else {
- $users{$login} = {
+ my $rh_user = {
login => $login,
- membership => $rh->{name} eq '_direct' ? 'direct' : 'indirect',
- group => $group_name,
- groups => [ $group_name ],
- lastseen => $member->{lastseen},
+ membership => $rh->{name} eq 'direct' ? 'direct' : 'indirect',
+ rh_name => $rh->{name},
};
+ if ($privileged) {
+ $rh_user->{group} = $rh->{name};
+ $rh_user->{groups} = [ $rh->{name} ];
+ $rh_user->{lastseeon} = $member->{lastseen};
+ $rh_user->{mfa} = $member->mfa;
+ $rh_user->{api_key_only} = $member->settings->{api_key_only}->{value} eq 'on'
+ ? JSON::true : JSON::false;
+ }
+ $users{$login} = $rh_user;
}
}
}