2014-07-05 12:59:42 +00:00
|
|
|
class UserPolicy < ApplicationPolicy
|
|
|
|
|
|
|
|
class Scope < Struct.new(:user, :scope)
|
|
|
|
def resolve
|
|
|
|
scope
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-04-28 13:11:19 +00:00
|
|
|
def permitted_attributes
|
|
|
|
attrs = [:username, :name, :email, :theme_name]
|
|
|
|
attrs << :asciicasts_private_by_default if record.supporter?
|
|
|
|
|
|
|
|
attrs
|
|
|
|
end
|
|
|
|
|
2014-07-05 12:59:42 +00:00
|
|
|
def update?
|
|
|
|
record == user
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|