summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2015-06-23 22:36:35 -0700
committerStan Hu <stanhu@gmail.com>2015-06-23 22:41:59 -0700
commit6548e9b48c079bb29cfe61eff99179e880583641 (patch)
treed189ff431a8b85f9e39c978f99e8fe3d87a97b43
parent764b5913c8f960d09d4777e3233662f507b0ec13 (diff)
downloadgitlab-ce-6548e9b48c079bb29cfe61eff99179e880583641.tar.gz
Add 2FA status to user admin API
Closes https://github.com/gitlabhq/gitlabhq/issues/9391
-rw-r--r--CHANGELOG1
-rw-r--r--doc/api/users.md6
-rw-r--r--lib/api/entities.rb1
-rw-r--r--spec/requests/api/users_spec.rb1
4 files changed, 7 insertions, 2 deletions
diff --git a/CHANGELOG b/CHANGELOG
index f353a444fba..4f5dcd75c6d 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
Please view this file on the master branch, on stable branches it's out of date.
v 7.13.0 (unreleased)
+ - Add `two_factor_enabled` field to admin user API (Stan Hu)
- Fix invalid timestamps in RSS feeds (Rowan Wookey)
- Fix error when deleting a user who has projects (Stan Hu)
- Fix downloading of patches on public merge requests when user logged out (Stan Hu)
diff --git a/doc/api/users.md b/doc/api/users.md
index cd141daadc8..8b04282f160 100644
--- a/doc/api/users.md
+++ b/doc/api/users.md
@@ -58,7 +58,8 @@ GET /users
"is_admin": false,
"avatar_url": "http://localhost:3000/uploads/user/avatar/1/cd8.jpeg",
"can_create_group": true,
- "current_sign_in_at": "2014-03-19T13:12:15Z"
+ "current_sign_in_at": "2014-03-19T13:12:15Z",
+ "two_factor_enabled": true
},
{
"id": 2,
@@ -81,7 +82,8 @@ GET /users
"can_create_group": true,
"can_create_project": true,
"projects_limit": 100,
- "current_sign_in_at": "2014-03-19T17:54:13Z"
+ "current_sign_in_at": "2014-03-19T17:54:13Z",
+ "two_factor_enabled": false
}
]
```
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index b23eff3661c..14a8f929d76 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -24,6 +24,7 @@ module API
expose :identities, using: Entities::Identity
expose :can_create_group?, as: :can_create_group
expose :can_create_project?, as: :can_create_project
+ expose :two_factor_enabled
end
class UserLogin < UserFull
diff --git a/spec/requests/api/users_spec.rb b/spec/requests/api/users_spec.rb
index c10998e171f..1a29058f3f1 100644
--- a/spec/requests/api/users_spec.rb
+++ b/spec/requests/api/users_spec.rb
@@ -35,6 +35,7 @@ describe API::API, api: true do
expect(json_response.first.keys).to include 'email'
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'
end
end
end