Class: Hyrax::VisibilityReader
- Inherits:
-
Object
- Object
- Hyrax::VisibilityReader
- Defined in:
- app/services/hyrax/visibility_reader.rb
Overview
Translates a set of ACLs into a visibility string.
Instance Attribute Summary collapse
-
#permission_manager ⇒ Object
readonly
Returns the value of attribute permission_manager.
- #resource ⇒ Valkyrie::Resource
Instance Method Summary collapse
-
#initialize(resource:) ⇒ VisibilityReader
constructor
A new instance of VisibilityReader.
- #read ⇒ String
- #visibility_map ⇒ Object
Constructor Details
#initialize(resource:) ⇒ VisibilityReader
Returns a new instance of VisibilityReader.
26 27 28 29 |
# File 'app/services/hyrax/visibility_reader.rb', line 26 def initialize(resource:) self.resource = resource @permission_manager = resource. end |
Instance Attribute Details
#permission_manager ⇒ Object (readonly)
Returns the value of attribute permission_manager.
21 22 23 |
# File 'app/services/hyrax/visibility_reader.rb', line 21 def @permission_manager end |
#resource ⇒ Valkyrie::Resource
21 |
# File 'app/services/hyrax/visibility_reader.rb', line 21 attr_reader :permission_manager |
Instance Method Details
#read ⇒ String
33 34 35 36 37 38 39 40 41 |
# File 'app/services/hyrax/visibility_reader.rb', line 33 def read if .read_groups.include? Hydra::AccessControls::AccessRight::PERMISSION_TEXT_VALUE_PUBLIC visibility_map.visibility_for(group: Hydra::AccessControls::AccessRight::PERMISSION_TEXT_VALUE_PUBLIC) elsif .read_groups.include? Hydra::AccessControls::AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED visibility_map.visibility_for(group: Hydra::AccessControls::AccessRight::PERMISSION_TEXT_VALUE_AUTHENTICATED) else visibility_map.visibility_for(group: :PRIVATE) end end |
#visibility_map ⇒ Object
43 44 45 |
# File 'app/services/hyrax/visibility_reader.rb', line 43 def visibility_map Hyrax.config.visibility_map end |