Files
project-work/worker-toolkit-stocks-in-the-future/repo/app/policies/portfolio_policy.rb
Eric Bell 2854619bc9 chore: init commit
in worker.../repo/GITFOLDER.zip is the .git folder.
2026-08-11 14:44:09 -04:00

19 lines
370 B
Ruby

# frozen_string_literal: true
class PortfolioPolicy < ApplicationPolicy
def show?
return false if user.blank?
return true if user.admin?
return true if record.user_id == user.id
user.teacher? && teacher_access?
end
private
def teacher_access?
teacher_ids = record.user&.classroom&.teacher_ids
teacher_ids&.include?(user.id)
end
end