app/models/apicasso/ability.rb in apicasso-0.4.11 vs app/models/apicasso/ability.rb in apicasso-0.5.0
- old
+ new
@@ -3,9 +3,12 @@
module Apicasso
# Ability to parse a scope object from Apicasso::Key
class Ability
include CanCan::Ability
+ # Method that initializes CanCanCan with the scope of
+ # permissions based on current key from request
+ # @param key [Object] a key object by APIcasso to CanCanCan with ability
def initialize(key)
key ||= Apicasso::Key.new
cannot :manage, :all
cannot :read, :all
key.scope.each do |permission, klasses_clearances|