app/contracts/user_preferences/base_contract.rb
##
# User preferences can only be accessed with the manage_user permission
# or if an active, logged user is editing their own prefs
User preferences can only be accessed with the manage_user permission
or if an active, logged user is editing their own prefs
User preferences can only be accessed with the manage_user permission or if an active logged user is editing their own prefs
def user_allowed_to_access
      unless user.allowed_to_globally?(:manage_user) || (user.logged? && user.active? && user.id == model.user_id)
        errors.add :base, :error_unauthorized
      end
    end
def user_allowed_to_access unless user . allowed_to_globally? ( :manage_user ) || ( user . logged? && user . active? && user . id == model . user_id ) errors . add :base , :error_unauthorized end end
User preferences can only be accessed with the manage_user permission
or if an active, logged user is editing their own prefs
User preferences can only be accessed with the manage_user permission or if an active logged user is editing their own prefs