Class: AccessRight
- Inherits:
-
Object
- Object
- AccessRight
- Extended by:
- Forwardable, MethodDecorators
- Defined in:
- app/models/access_right.rb
Constant Summary collapse
- PERMISSION_TEXT_VALUE_PUBLIC =
'public'.freeze
- PERMISSION_TEXT_VALUE_AUTHENTICATED =
'registered'.freeze
- VISIBILITY_TEXT_VALUE_PUBLIC =
'open'.freeze
- VISIBILITY_TEXT_VALUE_EMBARGO =
'open_with_embargo_release_date'.freeze
- VISIBILITY_TEXT_VALUE_AUTHENTICATED =
'psu'.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
-
#initialize(permissionable) ⇒ AccessRight
constructor
A new instance of AccessRight.
- #open_access? ⇒ Boolean
- #open_access_with_embargo_release_date? ⇒ Boolean
- #private? ⇒ Boolean
Constructor Details
#initialize(permissionable) ⇒ AccessRight
Returns a new instance of AccessRight.
18 19 20 |
# File 'app/models/access_right.rb', line 18 def initialize() @permissionable = end |
Instance Attribute Details
#permissionable ⇒ Object (readonly)
Returns the value of attribute permissionable.
26 27 28 |
# File 'app/models/access_right.rb', line 26 def @permissionable end |
Instance Method Details
#authenticated_only? ⇒ Boolean
43 44 45 46 47 |
# File 'app/models/access_right.rb', line 43 def authenticated_only? return false if open_access? (PERMISSION_TEXT_VALUE_AUTHENTICATED) || has_visibility_text_for?(VISIBILITY_TEXT_VALUE_AUTHENTICATED) end |
#open_access? ⇒ Boolean
28 29 30 31 32 33 |
# File 'app/models/access_right.rb', line 28 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
35 36 37 38 39 40 41 |
# File 'app/models/access_right.rb', line 35 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
49 50 51 52 53 54 |
# File 'app/models/access_right.rb', line 49 def private? return false if open_access? return false if authenticated_only? return false if true end |