Sha256: ae17a7658b14dc8301f15055e099a61e7352cd7fb21555d1bce823617166d119
Contents?: true
Size: 1.95 KB
Versions: 1
Compression:
Stored size: 1.95 KB
Contents
module FcrepoAdmin class ObjectsController < ApplicationController include FcrepoAdmin::ControllerBehavior layout 'fcrepo_admin/objects' PROPERTIES = [:owner_id, :state, :create_date, :modified_date, :label] helper_method :object_properties before_filter :load_and_authorize_object before_filter :load_apo_info, :only => :show def show end def audit_trail if object_is_auditable? if params[:download] send_data @object.audit_trail.to_xml, :disposition => 'inline', :type => 'text/xml' end else render :text => I18n.t("fcrepo_admin.object.audit_trail.not_implemented"), :status => 404 end end private def load_and_authorize_object load_object authorize_object end def load_object @object = ActiveFedora::Base.find(params[:id], :cast => true) end def authorize_object action = params[:action] == 'audit_trail' ? :read : params[:action].to_sym authorize! action, @object end protected def object_properties @object_properties ||= PROPERTIES.inject(Hash.new) { |h, p| h[p] = @object.send(p); h } end def apo_relationship_name @object.reflections.each_value do |reflection| # XXX This test should also check that reflection class is identical to admin policy class return reflection.name if reflection.options[:property] == :is_governed_by && reflection.macro == :belongs_to end nil end def load_apo_info @apo_relationship_name ||= apo_relationship_name @object_admin_policy ||= @apo_relationship_name ? @object.send(@apo_relationship_name) : nil # Including Hydra::PolicyAwareAccessControlsEnforcement in ApplicationController # appears to be the only way that APO access control enforcement can be enabled. @apo_enforcement_enabled ||= self.class.ancestors.include?(Hydra::PolicyAwareAccessControlsEnforcement) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fcrepo_admin-0.3.3 | app/controllers/fcrepo_admin/objects_controller.rb |