class Hydra::Config::PermissionsConfig

Attributes

embargo[RW]
lease[RW]
policy_class[RW]

Public Class Methods

new() click to toggle source
# File lib/hydra/config.rb, line 62
def initialize
  @values = {}
  [:discover, :read, :edit].each do |key|
    @values[key] = GroupPermission.new(
      group:      solr_name("#{prefix}#{key}_access_group", :symbol),
      individual: solr_name("#{prefix}#{key}_access_person", :symbol))
  end
  @embargo = EmbargoConfig.new({}, prefix: prefix)
  @lease = LeaseConfig.new({}, prefix: prefix)
end

Public Instance Methods

[](key) click to toggle source
# File lib/hydra/config.rb, line 92
def [] key
  case key
    when :discover, :read, :edit
      @values[key]
    when :inheritable
      inheritable
    when :policy_class
      @policy_class
    else
      raise "Unknown key #{key}"
  end
end
[]=(key, value) click to toggle source
# File lib/hydra/config.rb, line 77
def []= key, value
  case key
    when :discover, :read, :edit
      self.assign_value key, value
    when :inheritable
      inheritable.merge! value
    when :policy_class
      self.policy_class = value
    when :owner
      Rails.logger.warn "':owner' is no longer a valid configuration for Hydra. Please remove it from your configuration."
    else
      raise "Unknown key `#{key.inspect}`"
  end
end
discover() click to toggle source
# File lib/hydra/config.rb, line 109
def discover
  @values[:discover]
end
discover=(val) click to toggle source
# File lib/hydra/config.rb, line 121
def discover= val
  assign_value :discover, val
end
edit() click to toggle source
# File lib/hydra/config.rb, line 117
def edit
  @values[:edit]
end
edit=(val) click to toggle source
# File lib/hydra/config.rb, line 129
def edit= val
  assign_value :edit, val
end
inheritable() click to toggle source
# File lib/hydra/config.rb, line 105
def inheritable
  @inheritable ||= InheritablePermissionsConfig.new
end
merge!(values) click to toggle source
# File lib/hydra/config.rb, line 73
def merge! values
  values.each {|k, v| self[k] = v }
end
read() click to toggle source
# File lib/hydra/config.rb, line 113
def read
  @values[:read]
end
read=(val) click to toggle source
# File lib/hydra/config.rb, line 125
def read= val
  assign_value :read, val
end

Protected Instance Methods

assign_value(key, val) click to toggle source
# File lib/hydra/config.rb, line 138
def assign_value key, val
  @values[key].merge!(val)
end
prefix() click to toggle source
# File lib/hydra/config.rb, line 135
def prefix
end
solr_name(*args) click to toggle source
# File lib/hydra/config.rb, line 142
def solr_name(*args)
  ActiveFedora.index_field_mapper.solr_name(*args)
end