Sha256: 74f114a726c62ed28eb333c60a7d4928b2efc71ffb1b8efbdac89ba90b9f3f1d
Contents?: true
Size: 1.02 KB
Versions: 6
Compression:
Stored size: 1.02 KB
Contents
module RailsConnector class ObjsController < ActionController::Base before_filter :restrict_non_allow_access respond_to :json def update raise "Required parameter 'obj' is missing." unless params[:obj].present? raise "Parameter 'obj' is not a hash." unless params[:obj].is_a?(Hash) begin changed_obj = CmsRestApi.put( "revisions/#{Workspace.current.revision_id}/objs/#{params[:id]}", { :obj => params[:obj] } ) render :json => changed_obj rescue ClientError => e render :json => {:error => e.message}, :status => e.http_code end end private def restrict_non_allow_access unless allow_access? render(:text => 'Forbidden', :status => 403) end end # If +true+, allow access to ObjsController, else deny access. # See {RailsConnector::Configuration.editing_auth} for details. # @return [Bool] def allow_access? Configuration.editing_auth_callback.call(request.env) end end end
Version data entries
6 entries across 6 versions & 1 rubygems