Sha256: aef7843f55622cd5fbdeb677caa91c1e734d174c9054869e5cbf5587e93282e2

Contents?: true

Size: 1.21 KB

Versions: 2

Compression:

Stored size: 1.21 KB

Contents

module FcrepoAdmin
  module ObjectsHelper

    def object_title
      "#{object_type} #{@object.pid}"
    end

    def object_type
      @object.class.to_s
    end

    def object_has_permissions?
      @object.is_a?(Hydra::ModelMixins::RightsMetadata)
    end

    def object_model_belongs_to_apo?
      !@apo_relationship_name.nil?
    end

    def object_admin_policy
      @object_admin_policy
    end

    def object_has_admin_policy?
      !object_admin_policy.nil?
    end

    def object_has_inherited_permissions?
      object_has_admin_policy?
    end

    def object_inherited_permissions
      object_admin_policy && object_admin_policy.default_permissions
    end

    def admin_policy_enforcement_enabled?
      @apo_enforcement_enabled
    end

    def admin_policy_object?
      # XXX Ideally we would use Hydra::PolicyAwareAccessControlsEnforcement#policy_class,
      # but it's only available if it's been included in the application controller, i.e.,
      # if APO access control enforcement is enabled.  We want to know the name of the
      # relationship regardless of whether policy enforcement is enabled.
      @object.is_a?(Hydra.config[:permissions].fetch(:policy_class, Hydra::AdminPolicy))
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fcrepo_admin-0.3.3 app/helpers/fcrepo_admin/objects_helper.rb
fcrepo_admin-0.3.2 app/helpers/fcrepo_admin/objects_helper.rb