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
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
<?php

namespace App\Audit\ConcreteFormatters;

/**
* Copyright 2025 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 App\Models\Foundation\Summit\ExtraQuestions\AssignedSelectionPlanExtraQuestionType;
use Illuminate\Support\Facades\Log;

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

try {
$id = $subject->getId() ?? 'unknown';

switch ($this->event_type) {
case IAuditStrategy::EVENT_ENTITY_CREATION:
$question_type = $subject->getQuestionType();
$question_label = $question_type ? ($question_type->getLabel() ?? 'Unknown Question') : 'Unknown Question';
$selection_plan = $subject->getSelectionPlan();
$selection_plan_id = $selection_plan ? ($selection_plan->getId() ?? 'unknown') : 'unknown';
$selection_plan_name = $selection_plan ? ($selection_plan->getName() ?? 'Unknown') : 'Unknown';
$is_editable = $subject->isEditable() ? 'editable' : 'not editable';
return sprintf(
"Assigned Selection Plan Extra Question (%s) '%s' created for selection plan %s '%s' as %s by user %s",
$id,
$question_label,
$selection_plan_id,
$selection_plan_name,
$is_editable,
$this->getUserInfo()
);

case IAuditStrategy::EVENT_ENTITY_UPDATE:
$question_type = $subject->getQuestionType();
$question_label = $question_type ? ($question_type->getLabel() ?? 'Unknown Question') : 'Unknown Question';
$change_details = $this->buildChangeDetails($change_set);
return sprintf(
"Assigned Selection Plan Extra Question (%s) '%s' updated: %s by user %s",
$id,
$question_label,
$change_details,
$this->getUserInfo()
);

case IAuditStrategy::EVENT_ENTITY_DELETION:
$question_type = $subject->getQuestionType();
$question_label = $question_type ? ($question_type->getLabel() ?? 'Unknown Question') : 'Unknown Question';
return sprintf(
"Assigned Selection Plan Extra Question (%s) '%s' was deleted by user %s",
$id,
$question_label,
$this->getUserInfo()
);
}
} catch (\Exception $ex) {
Log::warning("AssignedSelectionPlanExtraQuestionTypeAuditLogFormatter error: " . $ex->getMessage());
}

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

namespace App\Audit\ConcreteFormatters;

/**
* Copyright 2025 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 App\Models\Foundation\Summit\SelectionPlanAllowedEditablePresentationQuestion;
use Illuminate\Support\Facades\Log;

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

try {
$id = $subject->getId() ?? 'unknown';
$type = $subject->getType() ?? 'Unknown Question Type';

switch ($this->event_type) {
case IAuditStrategy::EVENT_ENTITY_CREATION:
$selection_plan = $subject->getSelectionPlan();
$selection_plan_id = $selection_plan ? ($selection_plan->getId() ?? 'unknown') : 'unknown';
$selection_plan_name = $selection_plan ? ($selection_plan->getName() ?? 'Unknown') : 'Unknown';
return sprintf(
"Selection Plan Allowed Editable Presentation Question (%s) type '%s' created for selection plan %s '%s' by user %s",
$id,
$type,
$selection_plan_id,
$selection_plan_name,
$this->getUserInfo()
);

case IAuditStrategy::EVENT_ENTITY_UPDATE:
$change_details = $this->buildChangeDetails($change_set);
return sprintf(
"Selection Plan Allowed Editable Presentation Question (%s) type '%s' updated: %s by user %s",
$id,
$type,
$change_details,
$this->getUserInfo()
);

case IAuditStrategy::EVENT_ENTITY_DELETION:
return sprintf(
"Selection Plan Allowed Editable Presentation Question (%s) type '%s' was deleted by user %s",
$id,
$type,
$this->getUserInfo()
);
}
} catch (\Exception $ex) {
Log::warning("SelectionPlanAllowedEditablePresentationQuestionAuditLogFormatter error: " . $ex->getMessage());
}

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

namespace App\Audit\ConcreteFormatters;

/**
* Copyright 2025 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 App\Models\Foundation\Summit\SelectionPlanAllowedPresentationQuestion;
use Illuminate\Support\Facades\Log;

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

try {
$id = $subject->getId() ?? 'unknown';
$type = $subject->getType() ?? 'Unknown Question Type';

switch ($this->event_type) {
case IAuditStrategy::EVENT_ENTITY_CREATION:
$selection_plan = $subject->getSelectionPlan();
$selection_plan_id = $selection_plan ? ($selection_plan->getId() ?? 'unknown') : 'unknown';
$selection_plan_name = $selection_plan ? ($selection_plan->getName() ?? 'Unknown') : 'Unknown';
return sprintf(
"Selection Plan Allowed Presentation Question (%s) type '%s' created for selection plan %s '%s' by user %s",
$id,
$type,
$selection_plan_id,
$selection_plan_name,
$this->getUserInfo()
);

case IAuditStrategy::EVENT_ENTITY_UPDATE:
$change_details = $this->buildChangeDetails($change_set);
return sprintf(
"Selection Plan Allowed Presentation Question (%s) type '%s' updated: %s by user %s",
$id,
$type,
$change_details,
$this->getUserInfo()
);

case IAuditStrategy::EVENT_ENTITY_DELETION:
return sprintf(
"Selection Plan Allowed Presentation Question (%s) type '%s' was deleted by user %s",
$id,
$type,
$this->getUserInfo()
);
}
} catch (\Exception $ex) {
Log::warning("SelectionPlanAllowedPresentationQuestionAuditLogFormatter error: " . $ex->getMessage());
}

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

namespace App\Audit\ConcreteFormatters;

/**
* Copyright 2025 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\SummitBookableVenueRoomAttributeType;
use Illuminate\Support\Facades\Log;

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

try {
$id = $subject->getId() ?? 'unknown';
$type = $subject->getType() ?? 'Unknown Type';

switch ($this->event_type) {
case IAuditStrategy::EVENT_ENTITY_CREATION:
$summit_id = $subject->getSummitId() ?? 'unknown';
return sprintf(
"Summit Bookable Venue Room Attribute Type (%s) '%s' created for summit %s by user %s",
$id,
$type,
$summit_id,
$this->getUserInfo()
);

case IAuditStrategy::EVENT_ENTITY_UPDATE:
$change_details = $this->buildChangeDetails($change_set);
return sprintf(
"Summit Bookable Venue Room Attribute Type (%s) '%s' updated: %s by user %s",
$id,
$type,
$change_details,
$this->getUserInfo()
);

case IAuditStrategy::EVENT_ENTITY_DELETION:
return sprintf(
"Summit Bookable Venue Room Attribute Type (%s) '%s' was deleted by user %s",
$id,
$type,
$this->getUserInfo()
);
}
} catch (\Exception $ex) {
Log::warning("SummitBookableVenueRoomAttributeTypeAuditLogFormatter error: " . $ex->getMessage());
}

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

namespace App\Audit\ConcreteFormatters;

/**
* Copyright 2025 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 App\Models\Foundation\Summit\Registration\SummitRegistrationFeedMetadata;
use Illuminate\Support\Facades\Log;

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

try {
$id = $subject->getId() ?? 'unknown';

switch ($this->event_type) {
case IAuditStrategy::EVENT_ENTITY_CREATION:
$key = $subject->getKey() ?? 'Unknown Key';
$value = $subject->getValue() ?? 'Unknown Value';
$summit_id = $subject->getSummitId() ?? 'unknown';
return sprintf(
"Summit Registration Feed Metadata (%s) key '%s' value '%s' created for summit %s by user %s",
$id,
$key,
$value,
$summit_id,
$this->getUserInfo()
);

case IAuditStrategy::EVENT_ENTITY_UPDATE:
$key = $subject->getKey() ?? 'Unknown Key';
$change_details = $this->buildChangeDetails($change_set);
return sprintf(
"Summit Registration Feed Metadata (%s) key '%s' updated: %s by user %s",
$id,
$key,
$change_details,
$this->getUserInfo()
);

case IAuditStrategy::EVENT_ENTITY_DELETION:
$key = $subject->getKey() ?? 'Unknown Key';
return sprintf(
"Summit Registration Feed Metadata (%s) key '%s' was deleted by user %s",
$id,
$key,
$this->getUserInfo()
);
}
} catch (\Exception $ex) {
Log::warning("SummitRegistrationFeedMetadataAuditLogFormatter error: " . $ex->getMessage());
}

return null;
}
}
Loading