Sha256: d7557f8d9d357b4973c4ad0819063ab5b4094c6988cc5b15af6be66c225127f8

Contents?: true

Size: 414 Bytes

Versions: 23

Compression:

Stored size: 414 Bytes

Contents

class RoleDecorator < ApplicationDecorator
  def can?(scope, account)
    role_scopes = account_permissions(account).map(&:scope)
    role_scopes.include?('manage') || role_scopes.include?(scope)
  end

  def has?(scope, account)
    account_permissions(account).map(&:scope).include?(scope)
  end

  def cached_permissions
    garner.bind(h.controller.session_token) do
      object.permissions
    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
aptible-rails-0.7.3 lib/aptible/rails/decorators/role_decorator.rb
aptible-rails-0.7.2 lib/aptible/rails/decorators/role_decorator.rb
aptible-rails-0.7.1 lib/aptible/rails/decorators/role_decorator.rb
aptible-rails-0.7.0 lib/aptible/rails/decorators/role_decorator.rb
aptible-rails-0.6.13 lib/aptible/rails/decorators/role_decorator.rb
aptible-rails-0.6.12 lib/aptible/rails/decorators/role_decorator.rb
aptible-rails-0.6.11 lib/aptible/rails/decorators/role_decorator.rb
aptible-rails-0.6.10 lib/aptible/rails/decorators/role_decorator.rb
aptible-rails-0.6.9 lib/aptible/rails/decorators/role_decorator.rb
aptible-rails-0.6.8 lib/aptible/rails/decorators/role_decorator.rb
aptible-rails-0.6.7 lib/aptible/rails/decorators/role_decorator.rb
aptible-rails-0.6.6 lib/aptible/rails/decorators/role_decorator.rb
aptible-rails-0.6.5 lib/aptible/rails/decorators/role_decorator.rb
aptible-rails-0.6.4 lib/aptible/rails/decorators/role_decorator.rb
aptible-rails-0.6.3 lib/aptible/rails/decorators/role_decorator.rb
aptible-rails-0.6.2 lib/aptible/rails/decorators/role_decorator.rb
aptible-rails-0.6.1 lib/aptible/rails/decorators/role_decorator.rb
aptible-rails-0.6.0 lib/aptible/rails/decorators/role_decorator.rb
aptible-rails-0.5.4 lib/aptible/rails/decorators/role_decorator.rb
aptible-rails-0.5.3 lib/aptible/rails/decorators/role_decorator.rb