Sha256: 732578f07e8955fa2fd90701843ec63694e0f46787b55b08957c1bc815b344d6

Contents?: true

Size: 1.29 KB

Versions: 2

Compression:

Stored size: 1.29 KB

Contents

module FcrepoAdmin::Helpers
  module ObjectsHelperBehavior
    include FcrepoAdmin::Helpers::FcrepoAdminHelperBehavior

    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.5 lib/fcrepo_admin/helpers/objects_helper_behavior.rb
fcrepo_admin-0.3.4 lib/fcrepo_admin/helpers/objects_helper_behavior.rb