Module: Constellation::Authorization::Default::ModelExtensions::InstanceMethods

Defined in:
lib/constellation/authorization/default.rb

Instance Method Summary collapse

Instance Method Details

#accepts_role?(role, user) ⇒ Boolean

Returns:

  • (Boolean)


34
35
36
37
38
39
40
41
42
# File 'lib/constellation/authorization/default.rb', line 34

def accepts_role?(role, user)
  if self.respond_to? role
    self.send(role) == user 
  elsif self.respond_to? role.pluralize
    self.send(role.pluralize).include?(user)
  else
    false
  end
end