21
1
Fork 0
mirror of https://github.com/Evolix/chexpire.git synced 2024-05-02 00:40:49 +02:00
chexpire/app/policies/notification_policy.rb
2018-08-02 00:29:53 +02:00

25 lines
428 B
Ruby

# Copyright (C) 2018 Colin Darie <colin@darie.eu>, 2018 Evolix <info@evolix.fr>
# License: GNU AGPL-3+ (see full text in LICENSE file)
class NotificationPolicy < ApplicationPolicy
class Scope < Scope
def resolve
scope.joins(:check).where(checks: { user: user })
end
end
def destroy?
check_owner?
end
def show?
false
end
private
def check_owner?
record.check.user == user
end
end