summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2016-03-08 17:30:10 +0000
committerRobert Speicher <robert@gitlab.com>2016-03-08 17:30:10 +0000
commitfe9a445faaaa5a90c9308b01877aadc1984a111b (patch)
tree37314e0d8567219944c59a8d910b492cb7f840ea
parent24663e80953ce48db600c17aa7baa91d8e38680c (diff)
parentb0d24ab1b52a78bf855a70886113b79707036029 (diff)
downloadgitlab-ce-fe9a445faaaa5a90c9308b01877aadc1984a111b.tar.gz
Merge branch 'evuez/gitlab-ce-add-info-user-api' into 'master'
Expose User#last_sign_in_at and User#confirmed_at for admins Closes #840 See merge request !3090
-rw-r--r--CHANGELOG1
-rw-r--r--doc/api/users.md2
-rw-r--r--lib/api/entities.rb2
-rw-r--r--spec/requests/api/users_spec.rb2
4 files changed, 7 insertions, 0 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 1c09111443a..75b05bf4152 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -12,6 +12,7 @@ v 8.6.0 (unreleased)
- Memoize @group in Admin::GroupsController (Yatish Mehta)
- Indicate how much an MR diverged from the target branch (Pierre de La Morinerie)
- Strip leading and trailing spaces in URL validator (evuez)
+ - Add "last_sign_in_at" and "confirmed_at" to GET /users/* API endpoints for admins (evuez)
- Return empty array instead of 404 when commit has no statuses in commit status API
- Add support for cross-project label references
- Update documentation to reflect Guest role not being enforced on internal projects
diff --git a/doc/api/users.md b/doc/api/users.md
index b7fc903825e..82c57a2fd43 100644
--- a/doc/api/users.md
+++ b/doc/api/users.md
@@ -151,6 +151,8 @@ Parameters:
"name": "John Smith",
"state": "active",
"created_at": "2012-05-23T08:00:58Z",
+ "confirmed_at": "2012-05-23T08:00:58Z",
+ "last_sign_in_at": "2015-03-23T08:00:58Z",
"bio": null,
"skype": "",
"linkedin": "",
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index b021db8fa5b..0779fb881a0 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -23,6 +23,8 @@ module API
end
class UserFull < User
+ expose :last_sign_in_at
+ expose :confirmed_at
expose :email
expose :theme_id, :color_scheme_id, :projects_limit, :current_sign_in_at
expose :identities, using: Entities::Identity
diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb
index b82c5c7685f..96e8c8c51f8 100644
--- a/spec/requests/api/users_spec.rb
+++ b/spec/requests/api/users_spec.rb
@@ -47,6 +47,8 @@ describe API::API, api: true do
expect(json_response.first.keys).to include 'identities'
expect(json_response.first.keys).to include 'can_create_project'
expect(json_response.first.keys).to include 'two_factor_enabled'
+ expect(json_response.first.keys).to include 'last_sign_in_at'
+ expect(json_response.first.keys).to include 'confirmed_at'
end
end
end