diff options
Diffstat (limited to 'lib/api/users.rb')
-rw-r--r-- | lib/api/users.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/api/users.rb b/lib/api/users.rb index 565a3544da2..2608fb87e22 100644 --- a/lib/api/users.rb +++ b/lib/api/users.rb @@ -241,7 +241,7 @@ module API authenticated_as_admin! params = declared_params(include_missing: false) - user = ::Users::CreateService.new(current_user, params).execute(skip_authorization: true) + user = ::Users::AuthorizedCreateService.new(current_user, params).execute if user.persisted? present user, with: Entities::UserWithAdmin, current_user: current_user @@ -1025,7 +1025,9 @@ module API detail 'This feature was introduced in GitLab 13.10.' end params do - requires :view_diffs_file_by_file, type: Boolean, desc: 'Flag indicating the user sees only one file diff per page' + optional :view_diffs_file_by_file, type: Boolean, desc: 'Flag indicating the user sees only one file diff per page' + optional :show_whitespace_in_diffs, type: Boolean, desc: 'Flag indicating the user sees whitespace changes in diffs' + at_least_one_of :view_diffs_file_by_file, :show_whitespace_in_diffs end put "preferences", feature_category: :users do authenticate! @@ -1043,6 +1045,14 @@ module API end end + desc "Get the current user's preferences" do + success Entities::UserPreferences + detail 'This feature was introduced in GitLab 14.0.' + end + get "preferences", feature_category: :users do + present current_user.user_preference, with: Entities::UserPreferences + end + desc 'Get a single email address owned by the currently authenticated user' do success Entities::Email end |