Class: Hydra::Config::PermissionsConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/hydra/config.rb

Direct Known Subclasses

InheritablePermissionsConfig

Defined Under Namespace

Classes: GroupPermission

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializePermissionsConfig

Returns a new instance of PermissionsConfig.



39
40
41
42
43
44
45
46
47
# File 'lib/hydra/config.rb', line 39

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_release_date = solr_name("#{prefix}embargo_release_date", Solrizer::Descriptor.new(:date, :stored, :indexed))
end

Instance Attribute Details

#embargo_release_dateObject

Returns the value of attribute embargo_release_date.



38
39
40
# File 'lib/hydra/config.rb', line 38

def embargo_release_date
  @embargo_release_date
end

#policy_classObject

Returns the value of attribute policy_class.



38
39
40
# File 'lib/hydra/config.rb', line 38

def policy_class
  @policy_class
end

Instance Method Details

#[](key) ⇒ Object



68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/hydra/config.rb', line 68

def [] key
  case key
    when :discover, :read, :edit
      @values[key]
    when :inheritable
      inheritable
    when :embargo_release_date
      @embargo_release_date
    when :policy_class
      @policy_class
    else
      raise "Unknown key #{key}"
  end
end

#[]=(key, value) ⇒ Object



53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/hydra/config.rb', line 53

def []= key, value
  case key
    when :discover, :read, :edit
      self.assign_value key, value
    when :embargo_release_date
      self.embargo_release_date = value
    when :policy_class
      self.policy_class = value
    when :owner
      logger.warn "':owner' is no longer a valid configuration for Hydra. Please remove it from your configuration."
    else
      raise "Unknown key"
  end
end

#discoverObject



87
88
89
# File 'lib/hydra/config.rb', line 87

def discover
  @values[:discover]
end

#discover=(val) ⇒ Object



99
100
101
# File 'lib/hydra/config.rb', line 99

def discover= val
  assign_value :discover, val
end

#editObject



95
96
97
# File 'lib/hydra/config.rb', line 95

def edit
  @values[:edit]
end

#edit=(val) ⇒ Object



107
108
109
# File 'lib/hydra/config.rb', line 107

def edit= val
  assign_value :edit, val
end

#inheritableObject



83
84
85
# File 'lib/hydra/config.rb', line 83

def inheritable
  @inheritable ||= InheritablePermissionsConfig.new
end

#merge!(values) ⇒ Object



49
50
51
# File 'lib/hydra/config.rb', line 49

def merge! values
  values.each {|k, v| self[k] = v }
end

#readObject



91
92
93
# File 'lib/hydra/config.rb', line 91

def read
  @values[:read]
end

#read=(val) ⇒ Object



103
104
105
# File 'lib/hydra/config.rb', line 103

def read= val
  assign_value :read, val
end