role === 'admin' && $file->revision->project_id === $project->id; } /** * Same IDOR guard as download(): generating or viewing a rendered preview * must only ever be reachable through the project the file actually belongs to. */ public function render(User $user, ProjectFile $file, Project $project): bool { return $user->role === 'admin' && $file->revision->project_id === $project->id; } }