2015-03-12 22:43:13 +00:00
|
|
|
class UserPolicy < ApplicationPolicy
|
|
|
|
|
2015-03-18 22:02:38 +00:00
|
|
|
def show?
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def update?
|
2015-03-26 23:52:57 +00:00
|
|
|
is_admin? || record == user
|
2015-03-18 22:02:38 +00:00
|
|
|
end
|
2015-04-01 22:34:14 +01:00
|
|
|
alias_method :notifiers?, :update?
|
|
|
|
alias_method :show_current_user?, :update?
|
|
|
|
alias_method :write?, :update?
|
2015-03-18 22:02:38 +00:00
|
|
|
|
2015-05-20 22:03:08 +01:00
|
|
|
# Public: Get list of parameters that the user is allowed to alter.
|
|
|
|
#
|
|
|
|
# Returns Array
|
|
|
|
def permitted_attributes
|
|
|
|
%i(
|
2015-05-26 22:48:22 +01:00
|
|
|
avatar
|
2015-05-20 22:03:08 +01:00
|
|
|
company
|
|
|
|
current_password
|
|
|
|
delete_avatar
|
|
|
|
email
|
|
|
|
hide_email
|
|
|
|
language
|
|
|
|
location
|
|
|
|
login
|
|
|
|
name
|
|
|
|
password
|
|
|
|
password_confirmation
|
|
|
|
professional_experience
|
|
|
|
remember_me
|
|
|
|
site
|
|
|
|
sound_notifications
|
|
|
|
uname
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2015-04-01 22:34:14 +01:00
|
|
|
class Scope < Scope
|
|
|
|
def show
|
|
|
|
scope
|
|
|
|
end
|
2015-03-17 22:33:16 +00:00
|
|
|
end
|
|
|
|
|
2015-03-12 22:43:13 +00:00
|
|
|
end
|