X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/721dd9c27d299455b9159457a095716f797389f1..5d3992daca978f714ff9d6758b6155b9f08ee3f5:/app/controllers/user_preference_controller.rb diff --git a/app/controllers/user_preference_controller.rb b/app/controllers/user_preference_controller.rb index 3b56c257b..d02313497 100644 --- a/app/controllers/user_preference_controller.rb +++ b/app/controllers/user_preference_controller.rb @@ -1,6 +1,8 @@ # Update and read user preferences, which are arbitrayr key/val pairs class UserPreferenceController < ApplicationController before_filter :authorize + before_filter :require_allow_read_prefs, :only => [:read_one, :read] + before_filter :require_allow_write_prefs, :except => [:read_one, :read] def read_one pref = UserPreference.find(@user.id, params[:preference_key]) @@ -52,8 +54,11 @@ class UserPreferenceController < ApplicationController # update the entire set of preferences def update - p = XML::Parser.new - p.string = request.raw_post + begin + p = XML::Parser.string(request.raw_post) + rescue LibXML::XML::Error, ArgumentError => ex + raise OSM::APIBadXMLError.new("preferences", xml, ex.message) + end doc = p.parse prefs = []