Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions app/Audit/ConcreteFormatters/AffiliationAuditLogFormatter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php

namespace App\Audit\ConcreteFormatters;

/**
* Copyright 2026 OpenStack Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/

use App\Audit\AbstractAuditLogFormatter;
use App\Audit\Interfaces\IAuditStrategy;
use models\main\Affiliation;
use Illuminate\Support\Facades\Log;

class AffiliationAuditLogFormatter extends AbstractAuditLogFormatter
{
public function format($subject, array $change_set): ?string
{
if (!$subject instanceof Affiliation) {
return null;
}

try {
$id = $subject->getId() ?? 'unknown';
$owner = $subject->getOwner();
$owner_name = $owner ? trim(($owner->getFirstName() ?? '') . ' ' . ($owner->getLastName() ?? '')) : 'Unknown Owner';
$job_title = $subject->getJobTitle() ?? 'Unknown Job Title';

switch ($this->event_type) {
case IAuditStrategy::EVENT_ENTITY_CREATION:
return sprintf("Affiliation (%s) for '%s' (%s) created by user %s", $id, $owner_name, $job_title, $this->getUserInfo());

case IAuditStrategy::EVENT_ENTITY_UPDATE:
$details = $this->buildChangeDetails($change_set);
return sprintf("Affiliation (%s) for '%s' (%s) updated: %s by user %s", $id, $owner_name, $job_title, $details, $this->getUserInfo());

case IAuditStrategy::EVENT_ENTITY_DELETION:
return sprintf("Affiliation (%s) for '%s' (%s) deleted by user %s", $id, $owner_name, $job_title, $this->getUserInfo());
}
} catch (\Exception $ex) {
Log::warning("AffiliationAuditLogFormatter error: " . $ex->getMessage());
}

return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php

namespace App\Audit\ConcreteFormatters;

/**
* Copyright 2026 OpenStack Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/

use App\Audit\AbstractAuditLogFormatter;
use App\Audit\Interfaces\IAuditStrategy;
use models\summit\PresentationAttendeeVote;
use Illuminate\Support\Facades\Log;

class PresentationAttendeeVoteAuditLogFormatter extends AbstractAuditLogFormatter
{
public function format($subject, array $change_set): ?string
{
if (!$subject instanceof PresentationAttendeeVote) {
return null;
}

try {
$id = $subject->getId() ?? 'unknown';
$presentation = $subject->getPresentation();
$title = $presentation ? ($presentation->getTitle() ?? 'Unknown Presentation') : 'Unknown Presentation';

switch ($this->event_type) {
case IAuditStrategy::EVENT_ENTITY_CREATION:
return sprintf("Presentation Attendee Vote (%s) for '%s' created by user %s", $id, $title, $this->getUserInfo());
case IAuditStrategy::EVENT_ENTITY_UPDATE:
$details = $this->buildChangeDetails($change_set);
return sprintf("Presentation Attendee Vote (%s) for '%s' updated: %s by user %s", $id, $title, $details, $this->getUserInfo());
case IAuditStrategy::EVENT_ENTITY_DELETION:
return sprintf("Presentation Attendee Vote (%s) for '%s' deleted by user %s", $id, $title, $this->getUserInfo());
}
} catch (\Exception $ex) {
Log::warning("PresentationAttendeeVoteAuditLogFormatter error: " . $ex->getMessage());
}

return null;
}
}
52 changes: 52 additions & 0 deletions app/Audit/ConcreteFormatters/SummitAttendeeAuditLogFormatter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php

namespace App\Audit\ConcreteFormatters;

/**
* Copyright 2026 OpenStack Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/

use App\Audit\AbstractAuditLogFormatter;
use App\Audit\Interfaces\IAuditStrategy;
use models\summit\SummitAttendee;
use Illuminate\Support\Facades\Log;

class SummitAttendeeAuditLogFormatter extends AbstractAuditLogFormatter
{
public function format($subject, array $change_set): ?string
{
if (!$subject instanceof SummitAttendee) {
return null;
}

try {
$id = $subject->getId() ?? 'unknown';
$name = trim(($subject->getFirstName() ?? '') . ' ' . ($subject->getSurname() ?? '')) ?: 'Unknown Attendee';

switch ($this->event_type) {
case IAuditStrategy::EVENT_ENTITY_CREATION:
return sprintf("Attendee (%s) '%s' created by user %s", $id, $name, $this->getUserInfo());

case IAuditStrategy::EVENT_ENTITY_UPDATE:
$details = $this->buildChangeDetails($change_set);
return sprintf("Attendee (%s) '%s' updated: %s by user %s", $id, $name, $details, $this->getUserInfo());

case IAuditStrategy::EVENT_ENTITY_DELETION:
return sprintf("Attendee (%s) '%s' deleted by user %s", $id, $name, $this->getUserInfo());
}
} catch (\Exception $ex) {
Log::warning("SummitAttendeeAuditLogFormatter error: " . $ex->getMessage());
}

return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?php

namespace App\Audit\ConcreteFormatters;

/**
* Copyright 2026 OpenStack Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/

use App\Audit\AbstractAuditLogFormatter;
use App\Audit\Interfaces\IAuditStrategy;
use models\summit\SummitAttendeeBadge;
use Illuminate\Support\Facades\Log;

class SummitAttendeeBadgeAuditLogFormatter extends AbstractAuditLogFormatter
{
public function format($subject, array $change_set): ?string
{
if (!$subject instanceof SummitAttendeeBadge) {
return null;
}

try {
$id = $subject->getId() ?? 'unknown';
$ticket = $subject->getTicket();
$owner = $ticket ? $ticket->getOwner() : null;
$owner_name = $owner ? trim(($owner->getFirstName() ?? '') . ' ' . ($owner->getSurname() ?? '')) : 'Unknown Owner';

switch ($this->event_type) {
case IAuditStrategy::EVENT_ENTITY_CREATION:
return sprintf("Attendee Badge (%s) for '%s' created by user %s", $id, $owner_name, $this->getUserInfo());
case IAuditStrategy::EVENT_ENTITY_UPDATE:
$details = $this->buildChangeDetails($change_set);
return sprintf("Attendee Badge (%s) for '%s' updated: %s by user %s", $id, $owner_name, $details, $this->getUserInfo());
case IAuditStrategy::EVENT_ENTITY_DELETION:
return sprintf("Attendee Badge (%s) for '%s' deleted by user %s", $id, $owner_name, $this->getUserInfo());
}
} catch (\Exception $ex) {
Log::warning("SummitAttendeeBadgeAuditLogFormatter error: " . $ex->getMessage());
}

return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php

namespace App\Audit\ConcreteFormatters;

/**
* Copyright 2026 OpenStack Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/

use App\Audit\AbstractAuditLogFormatter;
use App\Audit\Interfaces\IAuditStrategy;
use models\summit\SummitAttendeeNote;
use Illuminate\Support\Facades\Log;

class SummitAttendeeNoteAuditLogFormatter extends AbstractAuditLogFormatter
{
public function format($subject, array $change_set): ?string
{
if (!$subject instanceof SummitAttendeeNote) {
return null;
}

try {
$id = $subject->getId() ?? 'unknown';
$owner = $subject->getOwner();
$owner_name = $owner ? trim(($owner->getFirstName() ?? '') . ' ' . ($owner->getSurname() ?? '')) : 'Unknown Owner';

switch ($this->event_type) {
case IAuditStrategy::EVENT_ENTITY_CREATION:
return sprintf("Attendee Note (%s) for '%s' created by user %s", $id, $owner_name, $this->getUserInfo());
case IAuditStrategy::EVENT_ENTITY_UPDATE:
$details = $this->buildChangeDetails($change_set);
return sprintf("Attendee Note (%s) for '%s' updated: %s by user %s", $id, $owner_name, $details, $this->getUserInfo());
case IAuditStrategy::EVENT_ENTITY_DELETION:
return sprintf("Attendee Note (%s) for '%s' deleted by user %s", $id, $owner_name, $this->getUserInfo());
}
} catch (\Exception $ex) {
Log::warning("SummitAttendeeNoteAuditLogFormatter error: " . $ex->getMessage());
}

return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<?php

namespace App\Audit\ConcreteFormatters;

/**
* Copyright 2026 OpenStack Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/

use App\Audit\AbstractAuditLogFormatter;
use App\Audit\Interfaces\IAuditStrategy;
use models\summit\SummitAttendeeTicket;
use Illuminate\Support\Facades\Log;

class SummitAttendeeTicketAuditLogFormatter extends AbstractAuditLogFormatter
{
public function format($subject, array $change_set): ?string
{
if (!$subject instanceof SummitAttendeeTicket) {
return null;
}

try {
$id = $subject->getId() ?? 'unknown';
$owner = $subject->getOwner();
$owner_name = $owner ? trim(($owner->getFirstName() ?? '') . ' ' . ($owner->getSurname() ?? '')) : 'Unknown Owner';

switch ($this->event_type) {
case IAuditStrategy::EVENT_ENTITY_CREATION:
return sprintf("Attendee Ticket (%s) for '%s' created by user %s", $id, $owner_name, $this->getUserInfo());
case IAuditStrategy::EVENT_ENTITY_UPDATE:
$details = $this->buildChangeDetails($change_set);
return sprintf("Attendee Ticket (%s) for '%s' updated: %s by user %s", $id, $owner_name, $details, $this->getUserInfo());
case IAuditStrategy::EVENT_ENTITY_DELETION:
return sprintf("Attendee Ticket (%s) for '%s' deleted by user %s", $id, $owner_name, $this->getUserInfo());
}
} catch (\Exception $ex) {
Log::warning("SummitAttendeeTicketAuditLogFormatter error: " . $ex->getMessage());
}

return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?php

namespace App\Audit\ConcreteFormatters;

/**
* Copyright 2026 OpenStack Foundation
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
**/

use App\Audit\AbstractAuditLogFormatter;
use App\Audit\Interfaces\IAuditStrategy;
use models\summit\SummitAttendeeTicketTax;
use Illuminate\Support\Facades\Log;

class SummitAttendeeTicketTaxAuditLogFormatter extends AbstractAuditLogFormatter
{
public function format($subject, array $change_set): ?string
{
if (!$subject instanceof SummitAttendeeTicketTax) {
return null;
}

try {
$id = $subject->getId() ?? 'unknown';
$tax = $subject->getTax();
$tax_name = $tax ? ($tax->getName() ?? 'Unknown Tax') : 'Unknown Tax';
$ticket = $subject->getTicket();
$ticket_id = $ticket ? $ticket->getId() : 'unknown';

switch ($this->event_type) {
case IAuditStrategy::EVENT_ENTITY_CREATION:
return sprintf("Attendee Ticket Tax (%s) '%s' for ticket %s created by user %s", $id, $tax_name, $ticket_id, $this->getUserInfo());

case IAuditStrategy::EVENT_ENTITY_UPDATE:
$details = $this->buildChangeDetails($change_set);
return sprintf("Attendee Ticket Tax (%s) '%s' for ticket %s updated: %s by user %s", $id, $tax_name, $ticket_id, $details, $this->getUserInfo());

case IAuditStrategy::EVENT_ENTITY_DELETION:
return sprintf("Attendee Ticket Tax (%s) '%s' for ticket %s deleted by user %s", $id, $tax_name, $ticket_id, $this->getUserInfo());
}
} catch (\Exception $ex) {
Log::warning("SummitAttendeeTicketTaxAuditLogFormatter error: " . $ex->getMessage());
}

return null;
}
}
Loading