Sha256: 886bdd6a0aa75a5431f16123c4fa5b645522e45fb2f50242681418eec32e433f

Contents?: true

Size: 668 Bytes

Versions: 2

Compression:

Stored size: 668 Bytes

Contents

module FcrepoAdmin
  module ControllerBehavior

    def load_and_authz_object(param = :object_id)
      load_object param
      authorize_object
    end

    def load_object(param = :object_id)
      @object = ActiveFedora::Base.find(params[param], :cast => true)
    end

    def authorize_object
      authorize! params[:action].to_sym, @object
    end

    def load_and_authz_datastream
      load_datastream
      authorize_datastream
    end

    def load_datastream
      load_object unless @object
      @datastream = @object.datastreams[params[:id]]
    end

    def authorize_datastream
      authorize! params[:action].to_sym, @datastream
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fcrepo_admin-0.3.0 lib/fcrepo_admin/controller_behavior.rb
fcrepo_admin-0.2.4 lib/fcrepo_admin/controller_behavior.rb