Class: Tuersteher::RightSpecification

Inherits:
Object
  • Object
show all
Defined in:
lib/tuersteher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(right, negation) ⇒ RightSpecification

Returns a new instance of RightSpecification.



468
469
470
471
# File 'lib/tuersteher.rb', line 468

def initialize right, negation
  @negation = negation
  @rights = [right]
end

Instance Attribute Details

#negationObject (readonly)

Returns the value of attribute negation.



466
467
468
# File 'lib/tuersteher.rb', line 466

def negation
  @negation
end

#rightsObject (readonly)

Returns the value of attribute rights.



466
467
468
# File 'lib/tuersteher.rb', line 466

def rights
  @rights
end

Instance Method Details

#grant?(path_or_model, method, login_ctx) ⇒ Boolean

Returns:

  • (Boolean)


473
474
475
476
477
478
# File 'lib/tuersteher.rb', line 473

def grant? path_or_model, method, 
  return false if .nil?
  rc =@rights.any?{|right| .has_right?(right) }
  rc = !rc if @negation
  rc
end

#to_sObject



480
481
482
# File 'lib/tuersteher.rb', line 480

def to_s
  "#{@negation && 'not.'}rights(#{@rights.join(',')})"
end