Commit Graph

178 Commits

Author SHA1 Message Date
Stan Hu f0400dc7c0 Merge branch '12800-read-and-write-user-admin-notes-via-api-ce' into 'master'
CE Backport: Read and write User "Admin notes" via API

See merge request gitlab-org/gitlab-ce!30775
2019-07-16 22:13:26 +00:00
manojmj ce40c12849 CE: Read and write User "Admin notes" via API
This change adds the ability to read and
write admin notes for a user via the
USER API
2019-07-17 01:11:10 +05:30
Adam Hegyi 4959d8fd49 Migrate null values for users.private_profile
- Background migration for changing null values to false
- Set false as default value for private_profile DB column
2019-07-15 21:07:54 +00:00
Stan Hu d6f20b55b8 Add support for creating random passwords in user creation API
To avoid having to specify an actual password to create users, admins
can now use the `force_random_password` parameter to let Devise generate
a password.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/63826
2019-06-27 13:25:37 -07:00
Imre Farkas 3895e54741 CE port of Move EE specific lines in API::Users 2019-05-28 10:14:26 +00:00
Thiago Presa 538741f230 Add highest_role method to User 2019-03-22 09:54:03 +00:00
Nermin Vehabovic f9e38cd39f Added: Documentation for the API
Added: Specs for the API action
2019-02-26 23:18:40 +00:00
Rémy Coutable 8028a59d7a Merge branch '51913-api-getting-projects-for-users-with-dot-gets-404' into 'master'
API: Support username with dots

Closes #51913

See merge request gitlab-org/gitlab-ce!24395
2019-02-01 14:35:46 +00:00
Rémy Coutable 3a2abc1d50
Enable the Layout/ExtraSpacing cop
Signed-off-by: Rémy Coutable <remy@rymai.me>
2019-01-24 13:05:45 +01:00
Robert Schilling 2190704c61 API: Support username with dots 2019-01-15 17:16:03 +01:00
blackst0ne b44a2c801a Update specs to rails5 format
Updates specs to use new rails5 format.

The old format:
`get :show, { some: params }, { some: headers }`

The new format:
`get :show, params: { some: params }, headers: { some: headers }`
2018-12-19 10:04:31 +11:00
Imre Farkas f3cd24a9f3
Display impersonation token value only after creation
Since we migrated all PersonlAccessTokens to store only its hash in the
DB, the token value can no longer be shown to the user.
2018-11-12 12:16:25 +01:00
William George 1b153d497b Make getting a user by the username case insensitive 2018-10-18 09:06:44 +00:00
Ronald Claveau 7d55c1353d List public ssh keys by id or username without authentication 2018-10-03 19:28:13 +02:00
Stan Hu ced2a932d7 Add ability to skip user email confirmation with API
This gives admins the ability to send a `skip_confirmation` flag in the
`POST /users/:id/email` API endpoint to skip the verification step and
assume the given e-mail address is verified.

Closes #50876
2018-09-10 22:41:53 -07:00
Bob Van Landuyt 12095251c3 Add the message HTML to the UserStatus api 2018-08-01 12:42:04 +02:00
Bob Van Landuyt b4c4b48a8c Allow users to set a status
This can be done trough the API for the current user, or on the
profile page.
2018-07-30 15:01:26 +02:00
JX Terry 99011a61cf Add an option to have a private profile on GitLab 2018-07-24 12:46:19 +00:00
blackst0ne ddd2a25679 Replace 'Sidekiq::Testing.inline!' with 'perform_enqueued_jobs'
`perform_enqueued_jobs` is a Sidekiq method.
Using this method violates the Dependency inversion principle[0].

This commit replaces `perform_enqueued_jobs` with ActiveJob's abstract
method `perform_enqueued_jobs` in specs.

[0]: https://en.wikipedia.org/wiki/Dependency_inversion_principle
2018-07-23 15:34:54 +11:00
Francisco Javier López df45623b34 Restoring user v3 endpoint 2018-06-13 08:25:01 +00:00
Robert Speicher 6d165c740c Make all uses of `fixture_file_upload` use relative paths 2018-06-07 09:54:41 -05:00
Rémy Coutable 3f73b6bee0
Don't set the notification_email when only unconfirmed_email is changed
Signed-off-by: Rémy Coutable <remy@rymai.me>
2018-05-22 12:47:20 +02:00
Dmitriy Zaporozhets c87c55bb35 Add 2FA filter to users API for admins only
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2018-04-23 11:54:45 +03:00
Dmitriy Zaporozhets 28ef8cc56e
Add sorting options for /users API (admin only)
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
2018-02-06 16:00:33 +02:00
Daniel Juarez 0b9e1e1662 Skip confirmation user api 2017-11-21 15:47:58 +00:00
Markus Koller 6902848a9c
Support custom attributes on projects 2017-11-06 10:51:46 +01:00
Douwe Maan 3f24f9ed18 Add sudo API scope 2017-11-02 11:39:03 +01:00
Douwe Maan 294fa6fcdc Remove authentication using user.private_token 2017-11-02 11:39:02 +01:00
Jacopo 2f40dac352 Refactor `have_http_status` into `have_gitlab_http_status` in the specs 2017-10-20 10:13:18 +02:00
Markus Koller e9eae3eb0d Support custom attributes on users 2017-09-28 16:49:42 +00:00
Tiago Botelho d70b7a490d find_user users helper method no longer overrides find_user API helper method. 2017-09-26 19:14:19 +01:00
Rémy Coutable d59255a66f
Improve the Users API specs by asserting against the response schema
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-09-18 12:15:35 +02:00
Robert Schilling 97371848c5 API: Add GPG key management for admins 2017-09-05 14:30:53 +02:00
Robert Schilling b69579742b API: Add GPG key management 2017-09-05 14:30:53 +02:00
Robert Schilling 915dd57fe2 Add tests for the unmodified header 2017-08-28 17:10:34 +02:00
Rémy Coutable 09a348eb13
Include the `is_admin` field in the `GET /users/:id` API when current user is an admin
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-08-11 15:14:32 +02:00
Lin Jen-Shin (godfat) 0d35b08180 Allow logged in users to read user list under public restriction 2017-08-01 07:46:13 +00:00
Lin Jen-Shin 25e44edc30 Allow admin to read_users_list even if it's restricted 2017-07-25 16:49:26 +08:00
Rémy Coutable 91f63820a5
Return `is_admin` attribute in the GET /user endpoint for admins
Signed-off-by: Rémy Coutable <remy@rymai.me>
2017-07-12 12:45:46 +02:00
Paul Charlton cb3b4a15e6 Support multiple Redis instances based on queue type 2017-07-11 03:35:47 +00:00
James Lopez 5e66c6568b fix specs 2017-07-07 16:09:30 +02:00
James Lopez 377244dd45 refactor filters 2017-07-07 11:38:01 +02:00
James Lopez b08df253ef add finder and users API spec 2017-07-07 10:38:57 +02:00
Timothy Andrew 94258a6500 Fix build for !12300.
- The `/users` and `/users/:id` APIs are now accessible without
  authentication (!12445), and so scopes are not relevant for these endpoints.

- Previously, we were testing our scope declaration against these two methods.
  This commit moves these tests to other `GET` user endpoints which still
  require authentication.
2017-07-05 03:44:40 +00:00
Douwe Maan 5e2f7f25eb Merge branch 'master' into '33580-fix-api-scoping'
# Conflicts:
#   lib/api/users.rb
2017-07-04 15:00:01 +00:00
Timothy Andrew d1488268b2 Simplify authentication logic in the v4 users API for !12445.
- Rather than using an explicit check to turn off authentication for the
  `/users` endpoint, simply call `authenticate_non_get!`.

- All `GET` endpoints we wish to restrict already call
  `authenticated_as_admin!`, and so remain inacessible to anonymous users.

- This _does_ open up the `/users/:id` endpoint to anonymous access. It contains
  the same access check that `/users` users, and so is safe for use here.

- More context: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/12445#note_34031323
2017-07-04 12:19:48 +00:00
Timothy Andrew 5dedea358d Merge remote-tracking branch 'origin/master' into 34141-allow-unauthenticated-access-to-the-users-api
- Modify policy code to work with the `DeclarativePolicy` refactor
  in 37c401433b.
2017-06-30 13:45:51 +00:00
Timothy Andrew 3c88a7869b Implement review comments for !12445 from @godfat and @rymai.
- Use `GlobalPolicy` to authorize the users that a non-authenticated user can
  fetch from `/api/v4/users`. We allow access if the `Gitlab::VisibilityLevel::PUBLIC`
  visibility level is not restricted.

- Further, as before, `/api/v4/users` is only accessible to unauthenticated users if
  the `username` parameter is passed.

- Turn off `authenticate!` for the `/api/v4/users` endpoint by matching on the actual
  route + method, rather than the description.

- Change the type of `current_user` check in `UsersFinder` to be more
  compatible with EE.
2017-06-30 13:06:03 +00:00
Timothy Andrew 157c05f49d Test `/users` endpoints for the `read_user` scope.
- Test `GET` endpoints to check that the scope is allowed.
- Test `POST` endpoints to check that the scope is disallowed.
- Test both `v3` and `v4` endpoints.
2017-06-28 07:17:13 +00:00
Timothy Andrew 80c1ebaa83 Allow API scope declarations to be applied conditionally.
- Scope declarations of the form:

    allow_access_with_scope :read_user, if: -> (request) { request.get? }

  will only apply for `GET` requests

- Add a negative test to a `POST` endpoint in the `users` API to test this. Also
  test for this case in the `AccessTokenValidationService` unit tests.
2017-06-28 07:17:13 +00:00