Sha256: 9b876911968288baca9d74cc13cc2c223057bc2e680f1a3d89e13a2eddde956e

Contents?: true

Size: 857 Bytes

Versions: 6

Compression:

Stored size: 857 Bytes

Contents

module Scrivito
  module Proxy
    class ObjsController < WebserviceController
      def mget
        authorize_workspace_access(:read, workspace) do
          @result = fetch(:get, "objs/mget", params.slice(:ids, :include_deleted))
          render '/scrivito/proxy/index'
        end
      end

      def update
        authorize_workspace_access(:write, workspace) do
          obj_id = params.fetch(:obj_id)
          @result = fetch(:put, "objs/#{obj_id}", params.slice(:obj))
          render '/scrivito/proxy/index'
        end
      end

      private

      def fetch(type, path, options)
        CmsRestApi.task_unaware_request(type, "workspaces/#{workspace_id}/#{path}", options)
      end

      def workspace_id
        params.fetch(:workspace_id)
      end

      def workspace
        Workspace.find(workspace_id)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
scrivito_sdk-1.3.1 app/controllers/scrivito/proxy/objs_controller.rb
scrivito_sdk-1.3.1.rc1 app/controllers/scrivito/proxy/objs_controller.rb
scrivito_sdk-1.3.0 app/controllers/scrivito/proxy/objs_controller.rb
scrivito_sdk-1.3.0.rc3 app/controllers/scrivito/proxy/objs_controller.rb
scrivito_sdk-1.3.0.rc2 app/controllers/scrivito/proxy/objs_controller.rb
scrivito_sdk-1.3.0.rc1 app/controllers/scrivito/proxy/objs_controller.rb