Fix discrepancy between index action and show action. The index action allowed members to see name changes for undeleted users, but the show action didn't.
14 lines
291 B
Ruby
14 lines
291 B
Ruby
class UserNameChangeRequestPolicy < ApplicationPolicy
|
|
def index?
|
|
user.is_member?
|
|
end
|
|
|
|
def show?
|
|
user.is_admin? || (user.is_member? && !record.user.is_deleted?) || (record.user == user)
|
|
end
|
|
|
|
def permitted_attributes
|
|
[:desired_name, :desired_name_confirmation]
|
|
end
|
|
end
|