Class: Symphonia::User

Inherits:
ApplicationRecord show all
Includes:
Swagger::Blocks, 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.



58
59
60
# File 'app/models/symphonia/user.rb', line 58

def password_confirmation=(value)
  @password_confirmation = value
end

Instance Method Details

#allowed_to?(action) ⇒ Boolean

Returns:

  • (Boolean)


82
83
84
85
86
87
88
# File 'app/models/symphonia/user.rb', line 82

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)


90
91
92
93
94
95
96
97
98
# File 'app/models/symphonia/user.rb', line 90

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

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