Class: Hydra::Config::PermissionsConfig
- Inherits:
-
Object
- Object
- Hydra::Config::PermissionsConfig
show all
- Defined in:
- lib/hydra/config.rb
Defined Under Namespace
Classes: EmbargoConfig, GroupPermission, LeaseConfig
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of PermissionsConfig.
62
63
64
65
66
67
68
69
70
71
|
# 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
|
Instance Attribute Details
#embargo ⇒ Object
Returns the value of attribute embargo.
61
62
63
|
# File 'lib/hydra/config.rb', line 61
def embargo
@embargo
end
|
#lease ⇒ Object
Returns the value of attribute lease.
61
62
63
|
# File 'lib/hydra/config.rb', line 61
def lease
@lease
end
|
#policy_class ⇒ Object
Returns the value of attribute policy_class.
61
62
63
|
# File 'lib/hydra/config.rb', line 61
def policy_class
@policy_class
end
|
Instance Method Details
#[](key) ⇒ Object
92
93
94
95
96
97
98
99
100
101
102
103
|
# 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) ⇒ Object
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
# 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 ⇒ Object
109
110
111
|
# File 'lib/hydra/config.rb', line 109
def discover
@values[:discover]
end
|
#discover=(val) ⇒ Object
121
122
123
|
# File 'lib/hydra/config.rb', line 121
def discover= val
assign_value :discover, val
end
|
#edit ⇒ Object
117
118
119
|
# File 'lib/hydra/config.rb', line 117
def edit
@values[:edit]
end
|
#edit=(val) ⇒ Object
129
130
131
|
# File 'lib/hydra/config.rb', line 129
def edit= val
assign_value :edit, val
end
|
#merge!(values) ⇒ Object
73
74
75
|
# File 'lib/hydra/config.rb', line 73
def merge! values
values.each {|k, v| self[k] = v }
end
|
#read ⇒ Object
113
114
115
|
# File 'lib/hydra/config.rb', line 113
def read
@values[:read]
end
|
#read=(val) ⇒ Object
125
126
127
|
# File 'lib/hydra/config.rb', line 125
def read= val
assign_value :read, val
end
|