class Tuersteher::RolesSpecification
Attributes
negation[R]
roles[R]
Public Class Methods
new(role, negation)
click to toggle source
# File lib/tuersteher.rb, line 446 def initialize role, negation @negation = negation @roles = [role] end
Public Instance Methods
grant?(path_or_model, method, login_ctx)
click to toggle source
# File lib/tuersteher.rb, line 451 def grant? path_or_model, method, login_ctx return false if login_ctx.nil? # roles sind or verknüpft rc = @roles.any?{|role| login_ctx.has_role?(role) } rc = !rc if @negation rc end
to_s()
click to toggle source
# File lib/tuersteher.rb, line 459 def to_s role_s = @roles.size == 1 ? "role(:#{@roles.first})" : "roles(#{@roles.map{|r| ":#{r}"}.join(',')})" "#{@negation && 'not.'}#{role_s}" end