Sha256: e7ce345d643b2bf7a2972e04ee26965e144dc5430da834a2d98a25386d1870b4

Contents?: true

Size: 664 Bytes

Versions: 1

Compression:

Stored size: 664 Bytes

Contents

module FcrepoAdmin
  module ControllerBehavior

    def load_and_authz_object
      load_object
      authorize_object
    end

    def load_object
      @object = ActiveFedora::Base.find(params[:id], :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
      @object ||= ActiveFedora::Base.find(params[:object_id], :cast => true)
      @datastream = @object.datastreams[params[:id]]
    end

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

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fcrepo_admin-0.3.1 lib/fcrepo_admin/controller_behavior.rb