Class: Hydra::AccessControls::AccessRight
- Inherits:
-
Object
- Object
- Hydra::AccessControls::AccessRight
- Defined in:
- app/models/concerns/hydra/access_controls/access_right.rb
Constant Summary collapse
- PERMISSION_TEXT_VALUE_PUBLIC =
What these groups are called in the Hydra rightsMetadata XML:
'public'.freeze
- PERMISSION_TEXT_VALUE_AUTHENTICATED =
'registered'.freeze
- VISIBILITY_TEXT_VALUE_PUBLIC =
The values that get drawn to the page
'open'.freeze
- VISIBILITY_TEXT_VALUE_EMBARGO =
'open_with_embargo_release_date'.freeze
- VISIBILITY_TEXT_VALUE_AUTHENTICATED =
'authenticated'.freeze
- VISIBILITY_TEXT_VALUE_PRIVATE =
'restricted'.freeze
Instance Attribute Summary collapse
-
#permissionable ⇒ Object
readonly
Returns the value of attribute permissionable.
Instance Method Summary collapse
- #authenticated_only? ⇒ Boolean (also: #authenticated_only_access?)
-
#initialize(permissionable) ⇒ AccessRight
constructor
A new instance of AccessRight.
- #open_access? ⇒ Boolean
- #open_access_with_embargo_release_date? ⇒ Boolean
- #private? ⇒ Boolean (also: #private_access?)
Constructor Details
#initialize(permissionable) ⇒ AccessRight
Returns a new instance of AccessRight.
18 19 20 |
# File 'app/models/concerns/hydra/access_controls/access_right.rb', line 18 def initialize() @permissionable = end |
Instance Attribute Details
#permissionable ⇒ Object (readonly)
Returns the value of attribute permissionable.
22 23 24 |
# File 'app/models/concerns/hydra/access_controls/access_right.rb', line 22 def @permissionable end |
Instance Method Details
#authenticated_only? ⇒ Boolean Also known as: authenticated_only_access?
42 43 44 45 46 |
# File 'app/models/concerns/hydra/access_controls/access_right.rb', line 42 def authenticated_only? return false if open_access? (PERMISSION_TEXT_VALUE_AUTHENTICATED) || has_visibility_text_for?(VISIBILITY_TEXT_VALUE_AUTHENTICATED) end |
#open_access? ⇒ Boolean
27 28 29 30 31 32 |
# File 'app/models/concerns/hydra/access_controls/access_right.rb', line 27 def open_access? return true if has_visibility_text_for?(VISIBILITY_TEXT_VALUE_PUBLIC) # We don't want to know if its under embargo, simply does it have a date. # In this way, we can properly inform the label input && !..present? end |
#open_access_with_embargo_release_date? ⇒ Boolean
34 35 36 37 38 39 40 |
# File 'app/models/concerns/hydra/access_controls/access_right.rb', line 34 def return false unless return true if has_visibility_text_for?(VISIBILITY_TEXT_VALUE_EMBARGO) # We don't want to know if its under embargo, simply does it have a date. # In this way, we can properly inform the label input && ..present? end |
#private? ⇒ Boolean Also known as: private_access?
50 51 52 53 54 55 |
# File 'app/models/concerns/hydra/access_controls/access_right.rb', line 50 def private? return false if open_access? return false if authenticated_only? return false if true end |