Class: Symphonia::User

Inherits:
ApplicationRecord show all
Includes:
ModelAttributes, UserManagement
Defined in:
app/models/symphonia/user.rb

Defined Under Namespace

Classes: Anonymous

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from ApplicationRecord

#to_s

Instance Attribute Details

#password_confirmation=(value) ⇒ Object (writeonly)

Sets the attribute password_confirmation

Parameters:

  • value

    the value to set the attribute password_confirmation to.



33
34
35
# File 'app/models/symphonia/user.rb', line 33

def password_confirmation=(value)
  @password_confirmation = value
end

Instance Method Details

#allowed_to?(action) ⇒ Boolean

Returns:

  • (Boolean)


57
58
59
60
61
62
63
# File 'app/models/symphonia/user.rb', line 57

def allowed_to?(action)
  return true if admin?

  Rails.cache.fetch([:user_allowed_to, self, action]) do
    role_id && role.allowed_to?(action)
  end
end

#authorize?(controller, action) ⇒ Boolean

Returns:

  • (Boolean)


65
66
67
68
69
70
71
72
73
# File 'app/models/symphonia/user.rb', line 65

def authorize?(controller, action)
  return true if admin?

  if role_id
    role.authorize?(controller, action)
  else
    false
  end
end