Class: Hyrax::EditPermissionsService::PermissionPresenter Private
- Inherits:
-
Object
- Object
- Hyrax::EditPermissionsService::PermissionPresenter
- Defined in:
- app/services/hyrax/edit_permissions_service.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
A helper class to contain specific presentation logic related to the Hyrax::EditPermissionsService
Instance Method Summary collapse
-
#access ⇒ Object
private
String.
-
#can_edit? ⇒ Boolean
private
Boolean.
-
#granted_by_html_hint ⇒ Object
private
A hint at how permissions are granted.
-
#initialize(service:, permission_hash:) ⇒ PermissionPresenter
constructor
private
A new instance of PermissionPresenter.
-
#name ⇒ Object
private
String.
Constructor Details
#initialize(service:, permission_hash:) ⇒ PermissionPresenter
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of PermissionPresenter.
113 114 115 116 |
# File 'app/services/hyrax/edit_permissions_service.rb', line 113 def initialize(service:, permission_hash:) @service = service @permission_hash = end |
Instance Method Details
#access ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns String.
138 139 140 |
# File 'app/services/hyrax/edit_permissions_service.rb', line 138 def access @permission_hash.fetch(:access) end |
#can_edit? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns Boolean.
144 145 146 |
# File 'app/services/hyrax/edit_permissions_service.rb', line 144 def can_edit? !@service.(@permission_hash) end |
#granted_by_html_hint ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
A hint at how permissions are granted.
rubocop:disable Rails/OutputSafety
122 123 124 125 126 127 128 129 |
# File 'app/services/hyrax/edit_permissions_service.rb', line 122 def granted_by_html_hint html = "" @service..each do |managers| next unless name == managers.fetch(:name) html += "<br />Access granted via collection #{managers.fetch(:id)}" end html.html_safe end |
#name ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns String.
133 134 135 |
# File 'app/services/hyrax/edit_permissions_service.rb', line 133 def name @permission_hash.fetch(:name) end |