From afde24cdc32ba6ed814bad68453b6974c2c1f7c7 Mon Sep 17 00:00:00 2001 From: Matthew Landauer Date: Mon, 9 Sep 2024 22:02:04 +0000 Subject: [PATCH] Keep sorbet happy --- app/policies/api_key_policy.rb | 8 ++++++++ app/policies/api_usages_policy.rb | 3 +++ app/policies/background_jobs_policy.rb | 3 +++ app/policies/test_emails_policy.rb | 4 ++++ 4 files changed, 18 insertions(+) diff --git a/app/policies/api_key_policy.rb b/app/policies/api_key_policy.rb index df2a7fc03..cf0916613 100644 --- a/app/policies/api_key_policy.rb +++ b/app/policies/api_key_policy.rb @@ -2,27 +2,35 @@ # frozen_string_literal: true class ApiKeyPolicy < ApplicationPolicy + extend T::Sig + + sig { returns(T::Boolean) } def index? user.admin? end + sig { returns(T::Boolean) } def show? user.admin? end + sig { returns(T::Boolean) } def update? user.admin? end + sig { returns(T::Boolean) } def create? true end + sig { returns(T::Boolean) } def confirm? true end class Scope < ApplicationPolicy::Scope + sig { returns(ActiveRecord::Relation) } def resolve user.admin? ? scope.all : scope.where(user:) end diff --git a/app/policies/api_usages_policy.rb b/app/policies/api_usages_policy.rb index f5616020f..6716ebc82 100644 --- a/app/policies/api_usages_policy.rb +++ b/app/policies/api_usages_policy.rb @@ -2,6 +2,9 @@ # frozen_string_literal: true class ApiUsagesPolicy < ApplicationPolicy + extend T::Sig + + sig { returns(T::Boolean) } def index? user.admin? end diff --git a/app/policies/background_jobs_policy.rb b/app/policies/background_jobs_policy.rb index 2f8010e2d..558a3ec15 100644 --- a/app/policies/background_jobs_policy.rb +++ b/app/policies/background_jobs_policy.rb @@ -2,6 +2,9 @@ # frozen_string_literal: true class BackgroundJobsPolicy < ApplicationPolicy + extend T::Sig + + sig { returns(T::Boolean) } def index? user.admin? end diff --git a/app/policies/test_emails_policy.rb b/app/policies/test_emails_policy.rb index f1aa8780d..7c1bfa789 100644 --- a/app/policies/test_emails_policy.rb +++ b/app/policies/test_emails_policy.rb @@ -2,10 +2,14 @@ # frozen_string_literal: true class TestEmailsPolicy < ApplicationPolicy + extend T::Sig + + sig { returns(T::Boolean) } def index? user.admin? end + sig { returns(T::Boolean) } def create? user.admin? end