From f60eb60473a1dcfd2b874d5ebac6dca60da7c1ea Mon Sep 17 00:00:00 2001 From: Patricio Cano Date: Tue, 22 Sep 2015 16:26:59 -0500 Subject: Added ability to update or set the identity of an existing user, like the documentation said it was possible, but actually wasn't. --- lib/api/users.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'lib/api') diff --git a/lib/api/users.rb b/lib/api/users.rb index 813cc379e43..a98d668e02d 100644 --- a/lib/api/users.rb +++ b/lib/api/users.rb @@ -121,6 +121,17 @@ module API User.where(username: attrs[:username]). where.not(id: user.id).count > 0 + identity_attrs = attributes_for_keys [:provider, :extern_uid] + if identity_attrs.any? + identity = user.identities.find_by(provider: identity_attrs[:provider]) + if identity + identity.update_attributes(identity_attrs) + else + identity = user.identities.build(identity_attrs) + identity.save + end + end + if user.update_attributes(attrs) present user, with: Entities::UserFull else -- cgit v1.2.1 From 22db4398c69e75da8c56775a7c815b6e2cb38496 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 24 Sep 2015 12:33:11 -0400 Subject: api: expose note_events and enable_ssl_verification for hooks --- lib/api/entities.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/api') diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 33b6224a810..9620d36ac41 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -45,7 +45,7 @@ module API class ProjectHook < Hook expose :project_id, :push_events - expose :issues_events, :merge_requests_events, :tag_push_events + expose :issues_events, :merge_requests_events, :tag_push_events, :note_events, :enable_ssl_verification end class ForkedFromProject < Grape::Entity -- cgit v1.2.1 From eb912a534bee312d5d5e5bcc44767860c1c41864 Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Thu, 24 Sep 2015 12:34:16 -0400 Subject: api: add enable_ssl_verification to PUT/POST hooks --- lib/api/project_hooks.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'lib/api') diff --git a/lib/api/project_hooks.rb b/lib/api/project_hooks.rb index ad4d2e65dfd..882d1a083ad 100644 --- a/lib/api/project_hooks.rb +++ b/lib/api/project_hooks.rb @@ -44,7 +44,8 @@ module API :issues_events, :merge_requests_events, :tag_push_events, - :note_events + :note_events, + :enable_ssl_verification ] @hook = user_project.hooks.new(attrs) @@ -75,7 +76,8 @@ module API :issues_events, :merge_requests_events, :tag_push_events, - :note_events + :note_events, + :enable_ssl_verification ] if @hook.update_attributes attrs -- cgit v1.2.1