# File lib/pundit_roles/pundit_selectors.rb, line 69 def primary_create_associations @pundit_primary_permissions[:associations][:create] end
module PunditSelectors
Module containing selectors for various authorized attributes, can be accessed as, ex: permitted_show_attributes
Public Instance Methods
returns the permitted create associations of the associated models
# File lib/pundit_roles/pundit_selectors.rb, line 119 def association_create_associations return {} unless @pundit_permission_table associated_stuff = {} @pundit_permission_table.each do |role, action| associated_stuff[role] = action[:associations].slice(:create)[:create] end return associated_stuff end
returns the permitted create attributes of the associated models
# File lib/pundit_roles/pundit_selectors.rb, line 89 def association_create_attributes return {} unless @pundit_permission_table associated_stuff = {} @pundit_permission_table.each do |role, action| associated_stuff[role] = action[:attributes].slice(:create)[:create] end return associated_stuff end
returns the permission hashes of permitted associations, ex: {:posts => {:attributes => {:show => [:text]}, :associations => {:show => [:comments]}}}
# File lib/pundit_roles/pundit_selectors.rb, line 20 def association_permissions @pundit_permission_table end
returns the permitted show associations of the associated models
# File lib/pundit_roles/pundit_selectors.rb, line 109 def association_show_associations return {} unless @pundit_permission_table associated_stuff = {} @pundit_permission_table.each do |role, action| associated_stuff[role] = action[:associations].slice(:show)[:show] end return associated_stuff end
returns the permitted show attributes of the associated models
# File lib/pundit_roles/pundit_selectors.rb, line 79 def association_show_attributes return {} unless @pundit_permission_table associated_stuff = {} @pundit_permission_table.each do |role, action| associated_stuff[role] = action[:attributes].slice(:show)[:show] end return associated_stuff end
returns the permitted update associations of the associated models
# File lib/pundit_roles/pundit_selectors.rb, line 129 def association_update_associations return {} unless @pundit_permission_table associated_stuff = {} @pundit_permission_table.each do |role, action| associated_stuff[role] = action[:associations].slice(:update)[:update] end return associated_stuff end
returns the permitted update attributes of the associated models
# File lib/pundit_roles/pundit_selectors.rb, line 99 def association_update_attributes return {} unless @pundit_permission_table associated_stuff = {} @pundit_permission_table.each do |role, action| associated_stuff[role] = action[:attributes].slice(:update)[:update] end return associated_stuff end
returns the formatted attributes for :show, :create and :update, ready to plug-and-play
# File lib/pundit_roles/pundit_selectors.rb, line 10 def attribute_permissions @pundit_attribute_lists end
returns the permission hash for the primary model
# File lib/pundit_roles/pundit_selectors.rb, line 5 def permissions @pundit_primary_permissions end
returns the permitted associations in the form of [Array] -> [{:posts => {:comments => [:author]}}, :settings]
# File lib/pundit_roles/pundit_selectors.rb, line 15 def permitted_associations @pundit_permitted_associations end
# File lib/pundit_roles/pundit_selectors.rb, line 40 def permitted_create_associations @pundit_permitted_associations[:create] end
# File lib/pundit_roles/pundit_selectors.rb, line 28 def permitted_create_attributes @pundit_attribute_lists[:create] end
# File lib/pundit_roles/pundit_selectors.rb, line 36 def permitted_show_associations @pundit_permitted_associations[:show] end
# File lib/pundit_roles/pundit_selectors.rb, line 24 def permitted_show_attributes @pundit_attribute_lists[:show] end
# File lib/pundit_roles/pundit_selectors.rb, line 44 def permitted_update_associations @pundit_permitted_associations[:update] end
# File lib/pundit_roles/pundit_selectors.rb, line 32 def permitted_update_attributes @pundit_attribute_lists[:update] end
returns the permitted create associations of the primary model
returns the permitted create attributes of the primary model
# File lib/pundit_roles/pundit_selectors.rb, line 54 def primary_create_attributes @pundit_primary_permissions[:attributes][:create] end
returns the permitted show associations of the primary model
# File lib/pundit_roles/pundit_selectors.rb, line 64 def primary_show_associations @pundit_primary_permissions[:associations][:show] end
returns the permitted show attributes of the primary model
# File lib/pundit_roles/pundit_selectors.rb, line 49 def primary_show_attributes @pundit_primary_permissions[:attributes][:show] end
returns the permitted update associations of the primary model
# File lib/pundit_roles/pundit_selectors.rb, line 74 def primary_update_associations @pundit_primary_permissions[:associations][:update] end
returns the permitted update attributes of the primary model
# File lib/pundit_roles/pundit_selectors.rb, line 59 def primary_update_attributes @pundit_primary_permissions[:attributes][:update] end