Method: CanCan::Ability#permissions

Defined in:
lib/cancan/ability.rb

#permissionsObject

Return a hash of permissions for the user in the format of:

{
  can: can_hash,
  cannot: cannot_hash
}

Where can_hash and cannot_hash are formatted thusly:

{
  action: { subject: [attributes] }
}


266
267
268
269
270
271
272
273
# File 'lib/cancan/ability.rb', line 266

def permissions
  permissions_list = {
    can: Hash.new { |actions, k1| actions[k1] = Hash.new { |subjects, k2| subjects[k2] = [] } },
    cannot: Hash.new { |actions, k1| actions[k1] = Hash.new { |subjects, k2| subjects[k2] = [] } }
  }
  rules.each { |rule| extract_rule_in_permissions(permissions_list, rule) }
  permissions_list
end