Sha256: 6c942942c0878efd58785ad348830c9c4a5c324202f031be84c3681e2e5607a4

Contents?: true

Size: 662 Bytes

Versions: 17

Compression:

Stored size: 662 Bytes

Contents

module CanTango
  module Api
    module User
      module Can
        include Ability
        # Example: generated from types of accounts! (see below)
        # def admin_can?(*args)
        #   current_ability(:admin).can?(*args)
        # end
        def self.included(base)
          ::CanTango.config.users.registered.each do |user|
            base.class_eval %{
              def #{user}_can? *args
                current_ability(:#{user}).can?(*args)
              end

              def #{user}_cannot? *args
                current_ability(:#{user}).cannot?(*args)
              end
             }
          end
        end
      end
    end
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
cantango-0.9.4.1 lib/cantango/api/user/can.rb
cantango-0.9.4 lib/cantango/api/user/can.rb
cantango-0.9.3.2 lib/cantango/api/user/can.rb
cantango-0.8.9.5 lib/cantango/api/user/can.rb
cantango-0.8.9.4 lib/cantango/api/user/can.rb
cantango-0.8.9.3 lib/cantango/api/user/can.rb
cantango-0.8.9.2 lib/cantango/api/user/can.rb
cantango-0.8.9.1 lib/cantango/api/user/can.rb
cantango-0.8.9 lib/cantango/api/user/can.rb
cantango-0.8.8.1 lib/cantango/api/user/can.rb
cantango-0.8.8 lib/cantango/api/user/can.rb
cantango-0.8.7 lib/cantango/api/user/can.rb
cantango-0.8.6.2 lib/cantango/api/user/can.rb
cantango-0.8.6.1 lib/cantango/api/user/can.rb
cantango-0.8.6 lib/cantango/api/user/can.rb
cantango-0.8.5.1 lib/cantango/api/user/can.rb
cantango-0.8.0 lib/cantango/api/user/can.rb