Skip to content

Commit

Permalink
Bug 1767990 - Expose last_activity_ts in the /rest/user endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
suhaibmujahid committed May 5, 2022
1 parent 2fc807f commit 2064146
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 24 deletions.
2 changes: 2 additions & 0 deletions Bugzilla/User.pm
Expand Up @@ -80,6 +80,7 @@ sub DB_COLUMNS {
'profiles.extern_id',
'profiles.is_enabled',
$dbh->sql_date_format('last_seen_date', '%Y-%m-%d') . ' AS last_seen_date',
'profiles.last_activity_ts AS last_activity_time',
'profiles.password_change_required',
'profiles.password_change_reason',
'profiles.mfa',
Expand Down Expand Up @@ -666,6 +667,7 @@ sub showmybugslink { $_[0]->{showmybugslink}; }
sub email_disabled { $_[0]->{disable_mail} || !$_[0]->{is_enabled}; }
sub email_enabled { !$_[0]->email_disabled; }
sub last_seen_date { $_[0]->{last_seen_date}; }
sub last_activity_time { $_[0]->{last_activity_time}; }
sub password_change_required { $_[0]->{password_change_required}; }
sub password_change_reason { $_[0]->{password_change_reason}; }

Expand Down
17 changes: 9 additions & 8 deletions Bugzilla/WebService/User.pm
Expand Up @@ -298,14 +298,15 @@ sub get {
foreach my $user (@$in_group) {
my $user_info = filter $params,
{
id => $self->type('int', $user->id),
real_name => $self->type('string', $user->name),
nick => $self->type('string', $user->nick),
name => $self->type('email', $user->login),
email => $self->type('email', $user->email),
can_login => $self->type('boolean', $user->is_enabled ? 1 : 0),
iam_username => $self->type('string', $user->iam_username),
last_seen_date => $self->type('dateTime', $user->last_seen_date),
id => $self->type('int', $user->id),
real_name => $self->type('string', $user->name),
nick => $self->type('string', $user->nick),
name => $self->type('email', $user->login),
email => $self->type('email', $user->email),
can_login => $self->type('boolean', $user->is_enabled ? 1 : 0),
iam_username => $self->type('string', $user->iam_username),
last_seen_date => $self->type('dateTime', $user->last_seen_date),
last_activity_time => $self->type('dateTime', $user->last_activity_time),
};

if (Bugzilla->user->in_group('editusers')) {
Expand Down
33 changes: 17 additions & 16 deletions docs/en/rst/api/core/v1/user.rst
Expand Up @@ -346,40 +346,41 @@ include_disabled boolean By default, when using the ``match`` parameter,

* users: (array) Each object describes a user and has the following items:

================= ========= =====================================================
name type description
================= ========= =====================================================
id int The unique integer ID that Bugzilla uses to represent
================== ======== =====================================================
name type description
================== ======== =====================================================
id int The unique integer ID that Bugzilla uses to represent
this user. Even if the user's login name changes,
this will not change.
real_name string The actual name of the user. May be blank.
nick string The user's nickname. Currently this is extracted from
real_name string The actual name of the user. May be blank.
nick string The user's nickname. Currently this is extracted from
the real_name, name or email field.
email string The email address of the user.
name string The login name of the user. Note that in some
email string The email address of the user.
name string The login name of the user. Note that in some
situations this is different than their email.
can_login boolean A boolean value to indicate if the user can login
can_login boolean A boolean value to indicate if the user can login
into Bugzilla.
email_enabled boolean A boolean value to indicate if bug-related mail will
email_enabled boolean A boolean value to indicate if bug-related mail will
be sent to the user or not.
login_denied_text string A text field that holds the reason for disabling a
login_denied_text string A text field that holds the reason for disabling a
user from logging into Bugzilla. If empty then the
user account is enabled; otherwise it is
disabled/closed.
groups array Groups the user is a member of. If the currently
groups array Groups the user is a member of. If the currently
logged in user is querying their own account or is a
member of the 'editusers' group, the array will
contain all the groups that the user is a member of.
Otherwise, the array will only contain groups that
the logged in user can bless. Each object describes
the group and contains the items described in the
Group object below.
saved_searches array User's saved searches, each having the following
saved_searches array User's saved searches, each having the following
Search object items described below.
saved_reports array User's saved reports, each having the following
saved_reports array User's saved reports, each having the following
Search object items described below.
last_seen_date datetime The time when the user last loaded any page.
================= ========= =====================================================
last_seen_date datetime The time when the user last loaded any page.
last_activity_time datetime The time when the user last made a change to a bug.
================== ======== =====================================================

Group object:

Expand Down

0 comments on commit 2064146

Please sign in to comment.