Files
danbooru/app/policies/email_address_policy.rb
evazion 2537145b02 users: disallow banned users from changing email or deleting account.
This is to prevent people from wiping their email address after they've
been banned and reusing it to verify a new account.
2021-05-15 04:36:22 -05:00

24 lines
479 B
Ruby

class EmailAddressPolicy < ApplicationPolicy
def index?
user.is_moderator?
end
def show?
record.user_id == user.id || (user.is_moderator? && record.user.level < user.level)
end
def update?
# XXX here record is a user, not the email address.
record.id == user.id && !user.is_banned?
end
def verify?
record.user_id == user.id
end
def send_confirmation?
# XXX record is a user, not the email address.
record.id == user.id
end
end