Module: Permissify::Common
- Included in:
- Controller, Union
- Defined in:
- lib/permissify/common.rb
Instance Method Summary collapse
- #allowed_to?(action, ability_category) ⇒ Boolean
- #createable?(ability_category) ⇒ Boolean
- #deleteable?(ability_category) ⇒ Boolean
- #log_permissions ⇒ Object
- #permissible?(permissions_hash, action, category) ⇒ Boolean
- #subscribed_to?(ability_category) ⇒ Boolean
- #updateable?(ability_category) ⇒ Boolean
- #viewable?(ability_category) ⇒ Boolean
Instance Method Details
#allowed_to?(action, ability_category) ⇒ Boolean
4 5 6 |
# File 'lib/permissify/common.rb', line 4 def allowed_to?(action, ability_category) (action, ability_category) == true end |
#createable?(ability_category) ⇒ Boolean
9 |
# File 'lib/permissify/common.rb', line 9 def createable?(ability_category); allowed_to?(:create, ability_category); end |
#deleteable?(ability_category) ⇒ Boolean
11 |
# File 'lib/permissify/common.rb', line 11 def deleteable?(ability_category); allowed_to?(:delete, ability_category); end |
#log_permissions ⇒ Object
19 20 21 22 |
# File 'lib/permissify/common.rb', line 19 def = "*** PermissifyController permissions: #{@permissions.inspect}" defined?(logger) ? logger.debug() : puts() end |
#permissible?(permissions_hash, action, category) ⇒ Boolean
14 15 16 17 |
# File 'lib/permissify/common.rb', line 14 def permissible?(, action, category) key = Ability.key_for(action, category) ( = [key]) && ['0'] == true end |
#subscribed_to?(ability_category) ⇒ Boolean
12 |
# File 'lib/permissify/common.rb', line 12 def subscribed_to?(ability_category); allowed_to?(:on, ability_category); end |
#updateable?(ability_category) ⇒ Boolean
10 |
# File 'lib/permissify/common.rb', line 10 def updateable?(ability_category); allowed_to?(:update, ability_category); end |
#viewable?(ability_category) ⇒ Boolean
8 |
# File 'lib/permissify/common.rb', line 8 def viewable?(ability_category); allowed_to?(:view, ability_category); end |