Sha256: bcdc255b2689955bd9f10f3f1bf711899ec46f7fc5723e6ab6eacc3dee4281dc

Contents?: true

Size: 665 Bytes

Versions: 2

Compression:

Stored size: 665 Bytes

Contents

module FcrepoAdmin
  module ControllerBehavior

    def load_and_authz_object
      load_object
      authorize_object
    end

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

    def authorize_object
      #authorize_resource :instance_name => 'object'
      authorize! params[:action].to_sym, @object
    end

    def load_and_authz_datastream
      load_datastream
      authorize_datastream
    end

    def load_datastream
      load_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.2.3 lib/fcrepo_admin/controller_behavior.rb
fcrepo_admin-0.2.0 lib/fcrepo_admin/controller_behavior.rb