Open-source event management and ticket selling platform — perfect for concerts, conferences, and everything in between 🎟️ If you find this project helpful, please consider giving us a star ⭐️
PHP attendize-alternativedoor-managementevent-check-inevent-managementevent-registrationevent-ticketingeventbrite-alternativeeventslaravelopen-sourcephpreactself-hostedsell-ticketssell-tickets-onlineticket-sellingticketing-systemtickettailor-alternativetito-alternative
Fix event visibility for users from another account
Dave Earley881f282b6cbf
diff --git a/backend/app/Http/Actions/Events/GetEventPublicAction.php b/backend/app/Http/Actions/Events/GetEventPublicAction.phpindex 540153feb..57ce54265 100644--- a/backend/app/Http/Actions/Events/GetEventPublicAction.php+++ b/backend/app/Http/Actions/Events/GetEventPublicAction.php@@ -2,6 +2,7 @@namespace HiEvents\Http\Actions\Events;+use HiEvents\DomainObjects\EventDomainObject;use HiEvents\DomainObjects\Status\EventStatus;use HiEvents\Http\Actions\BaseAction;use HiEvents\Resources\Event\EventResourcePublic;@@ -30,7 +31,7 @@ class GetEventPublicAction extends BaseAction'isAuthenticated' => $this->isUserAuthenticated(),]));- if ($event->getStatus() !== EventStatus::LIVE->name && !$this->isUserAuthenticated()) {+ if (!$this->canUserViewEvent($event)) {$this->logger->debug(__('Event with ID :eventId is not live and user is not authenticated', ['eventId' => $eventId]));@@ -40,4 +41,17 @@ class GetEventPublicAction extends BaseActionreturn $this->resourceResponse(EventResourcePublic::class, $event);}++ private function canUserViewEvent(EventDomainObject $event): bool+ {+ if ($event->getStatus() === EventStatus::LIVE->name) {+ return true;+ }++ if ($this->isUserAuthenticated() && $event->getAccountId() === $this->getAuthenticatedAccountId()) {+ return true;+ }++ return false;+ }}