mirror of
https://github.com/Evolix/chexpire.git
synced 2024-06-28 12:02:52 +02:00
09be8a38c2
Validation is made when leaving the input field with an ajax call on the /checks/support.json path. JSON response include the normalized domain name (more TODO) and the supported status. UI is updated with Javascript accordingly to this response. Closes #62
33 lines
442 B
Ruby
33 lines
442 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 CheckPolicy < ApplicationPolicy
|
|
class Scope < Scope
|
|
def resolve
|
|
scope.where(user: user)
|
|
end
|
|
end
|
|
|
|
def create?
|
|
true
|
|
end
|
|
|
|
def update?
|
|
owner?
|
|
end
|
|
|
|
def destroy?
|
|
owner?
|
|
end
|
|
|
|
def supports?
|
|
new?
|
|
end
|
|
|
|
private
|
|
|
|
def owner?
|
|
record.user == user
|
|
end
|
|
end
|