Class: RoleDecorator

Inherits:
ApplicationDecorator show all
Defined in:
lib/aptible/rails/decorators/role_decorator.rb

Instance Method Summary collapse

Methods inherited from ApplicationDecorator

#pretty_errors

Instance Method Details

#cached_permissionsObject



11
12
13
14
15
# File 'lib/aptible/rails/decorators/role_decorator.rb', line 11

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

#can?(scope, account) ⇒ Boolean

Returns:

  • (Boolean)


2
3
4
5
# File 'lib/aptible/rails/decorators/role_decorator.rb', line 2

def can?(scope, )
  role_scopes = ().map(&:scope)
  role_scopes.include?('manage') || role_scopes.include?(scope)
end

#has?(scope, account) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/aptible/rails/decorators/role_decorator.rb', line 7

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