summaryrefslogtreecommitdiff
path: root/lib/api/v3/members.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/v3/members.rb')
-rw-r--r--lib/api/v3/members.rb7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/api/v3/members.rb b/lib/api/v3/members.rb
index 4e6cb2e3c52..19f276d5484 100644
--- a/lib/api/v3/members.rb
+++ b/lib/api/v3/members.rb
@@ -86,13 +86,12 @@ module API
optional :expires_at, type: DateTime, desc: 'Date string in the format YEAR-MONTH-DAY'
end
put ":id/members/:user_id" do
- source = find_source(source_type, params[:id])
+ source = find_source(source_type, params.delete(:id))
authorize_admin_source!(source_type, source)
- member = source.members.find_by!(user_id: params[:user_id])
- attrs = attributes_for_keys [:access_level, :expires_at]
+ member = source.members.find_by!(user_id: params.delete(:user_id))
- if member.update_attributes(attrs)
+ if member.update_attributes(declared_params(include_missing: false))
present member.user, with: ::API::Entities::Member, member: member
else
# This is to ensure back-compatibility but 400 behavior should be used