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