Class UserPreference
In: app/models/user_preference.rb
Parent: ActiveRecord::Base

Methods

Public Class methods

[Source]

    # File app/models/user_preference.rb, line 19
19:   def self.create_for_user(user,entity,attribute)
20:     user_preference = UserPreference.new
21:     user_preference.user_id = user.id
22:     user_preference.entity = entity
23:     user_preference.attribute = attribute
24:     user_preference.value = self.get_default(entity, attribute)
25:     user_preference.save!
26:     return user_preference
27:   end

Protected Instance methods

[Source]

    # File app/models/user_preference.rb, line 39
39:   def authorized_for_create?
40:     false
41:   end

[Source]

    # File app/models/user_preference.rb, line 47
47:   def authorized_for_destroy?
48:     return self == current_user ? true : Authorize.is_role_allowed_for_user?(current_user, UserRole::USER_ROLE_ROOT)
49:   end

[Source]

    # File app/models/user_preference.rb, line 35
35:   def authorized_for_read?
36:     true
37:   end

[Source]

    # File app/models/user_preference.rb, line 43
43:    def authorized_for_update?
44:     return self == current_user ? true : Authorize.is_role_allowed_for_user?(current_user, UserRole::USER_ROLE_ROOT)
45:   end

[Source]

    # File app/models/user_preference.rb, line 31
31:   def user_role_authorized?
32:     Authorize.is_role_allowed_for_user?(current_user, UserRole::USER_ROLE_ROOT)
33:   end

[Validate]