2023-04-03 18:23:49 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# Check the access policies for API::ChildrenController
|
|
|
|
class ChildPolicy < ApplicationPolicy
|
|
|
|
def create?
|
|
|
|
!user.organization? && user.id == record.user_id
|
|
|
|
end
|
|
|
|
|
|
|
|
def show?
|
2023-05-25 20:17:37 +02:00
|
|
|
user.privileged? || user.id == record.user_id
|
2023-04-03 18:23:49 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def update?
|
2023-05-25 20:17:37 +02:00
|
|
|
user.privileged? || user.id == record.user_id
|
2023-04-03 18:23:49 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def destroy?
|
2023-05-25 20:17:37 +02:00
|
|
|
user.privileged? || user.id == record.user_id
|
|
|
|
end
|
|
|
|
|
|
|
|
def validate?
|
|
|
|
user.privileged?
|
2023-04-03 18:23:49 +02:00
|
|
|
end
|
|
|
|
end
|