Skip to content

Commit

Permalink
Keep sorbet happy
Browse files Browse the repository at this point in the history
  • Loading branch information
mlandauer committed Sep 9, 2024
1 parent b3d8800 commit afde24c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/policies/api_key_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions app/policies/api_usages_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# frozen_string_literal: true

class ApiUsagesPolicy < ApplicationPolicy
extend T::Sig

sig { returns(T::Boolean) }
def index?
user.admin?
end
Expand Down
3 changes: 3 additions & 0 deletions app/policies/background_jobs_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
# frozen_string_literal: true

class BackgroundJobsPolicy < ApplicationPolicy
extend T::Sig

sig { returns(T::Boolean) }
def index?
user.admin?
end
Expand Down
4 changes: 4 additions & 0 deletions app/policies/test_emails_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit afde24c

Please sign in to comment.