Module: Hydra::AccessControlsEvaluation
- Defined in:
- lib/hydra/access_controls_evaluation.rb
Overview
will move to lib/hydra/access_control folder/namespace in release 5.x Provides methods for determining permissions If you include this into a Controller, it will also make a number of these methods available as view helpers.
Class Method Summary collapse
Instance Method Summary collapse
-
#editor? ⇒ Boolean
Test whether the the current user has edit permissions.
-
#reader? ⇒ Boolean
Test whether the the current user has read permissions.
-
#test_permission(permission_type) ⇒ Object
Test the current user’s permissions.
Class Method Details
.included(klass) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/hydra/access_controls_evaluation.rb', line 6 def self.included(klass) if klass.respond_to?(:helper_method) klass.helper_method(:editor?) klass.helper_method(:reader?) klass.helper_method(:test_permission?) end end |
Instance Method Details
#editor? ⇒ Boolean
Test whether the the current user has edit permissions.
This is available as a view helper method as well as within your controllers.
26 27 28 29 |
# File 'lib/hydra/access_controls_evaluation.rb', line 26 def editor? logger.warn("editor? has been deprecated. Use can? instead") can? :edit, @permissions_solr_document end |
#reader? ⇒ Boolean
Test whether the the current user has read permissions.
This is available as a view helper method as well as within your controllers.
33 34 35 36 |
# File 'lib/hydra/access_controls_evaluation.rb', line 33 def reader? logger.warn("reader? has been deprecated. Use can? instead") can? :read, @permissions_solr_document end |
#test_permission(permission_type) ⇒ Object
Test the current user’s permissions. This method is used by the editor? and reader? methods This is available as a view helper method as well as within your controllers.
19 20 21 22 |
# File 'lib/hydra/access_controls_evaluation.rb', line 19 def () ActiveSupport::Deprecation.warn("test_permission has been deprecated. Use can? instead") can? , @permissions_solr_document end |