Class: Recurso::Queries::Single

Inherits:
Struct
  • Object
show all
Defined in:
lib/recurso/queries/single.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#actionObject

Returns the value of attribute action

Returns:

  • (Object)

    the current value of action



3
4
5
# File 'lib/recurso/queries/single.rb', line 3

def action
  @action
end

#identityObject

Returns the value of attribute identity

Returns:

  • (Object)

    the current value of identity



3
4
5
# File 'lib/recurso/queries/single.rb', line 3

def identity
  @identity
end

#resourceObject

Returns the value of attribute resource

Returns:

  • (Object)

    the current value of resource



3
4
5
# File 'lib/recurso/queries/single.rb', line 3

def resource
  @resource
end

Instance Method Details

#permission?Boolean

Returns:

  • (Boolean)


4
5
6
7
8
9
# File 'lib/recurso/queries/single.rb', line 4

def permission?
  @permission ||= identity.permissions.exists?(
    resource: resource.relevant_resources,
    level:    resource.relevant_levels_for(action)
  )
end