From ea35aa086d63b2c694b53b91a112f8d3a52f1766 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Mon, 13 Oct 2025 11:38:16 -0300 Subject: [PATCH 1/9] feat: Extend Swagger Coverage for controller `OAuth2SummitAttendeeBadgePrintApiController` --- ...2SummitAttendeeBadgePrintApiController.php | 130 +++++++++++++++++- .../SummitRegistrationPrintSchemas.php | 41 +++++- update-traces-file.sh | 1 + 3 files changed, 165 insertions(+), 7 deletions(-) create mode 100755 update-traces-file.sh diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeeBadgePrintApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeeBadgePrintApiController.php index d5b4dcd65..d98e2a54e 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeeBadgePrintApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeeBadgePrintApiController.php @@ -14,9 +14,11 @@ use App\Http\Utils\EpochCellFormatter; use App\Models\Foundation\Summit\Repositories\ISummitAttendeeBadgePrintRepository; +use Illuminate\Http\Response; use models\oauth2\IResourceServerContext; use models\summit\ISummitRepository; use ModelSerializers\SerializerRegistry; +use OpenApi\Attributes as OA; use services\model\ISummitAttendeeBadgePrintService; use utils\Filter; use utils\FilterElement; @@ -49,6 +51,58 @@ public function __construct use ParametrizedGetAll; + #[OA\Get( + path: "/api/v1/summits/{id}/tickets/{ticket_id}/badge/current/prints", + summary: "Get all badge prints for a ticket", + description: "Returns a paginated list of badge print records for a specific ticket. Allows ordering, filtering and pagination.", + security: [["oauth2_security_scope" => ["openid", "profile", "email"]]], + tags: ["Summit Badge Prints"], + parameters: [ + new OA\Parameter(ref: "#/components/parameters/summit_id_path_param"), + new OA\Parameter( + name: "ticket_id", + in: "path", + required: true, + description: "Ticket ID", + schema: new OA\Schema(type: "integer") + ), + new OA\Parameter(ref: "#/components/parameters/page_number_param"), + new OA\Parameter(ref: "#/components/parameters/page_size_param"), + new OA\Parameter( + name: "filter[]", + in: "query", + required: false, + description: "Filter badge prints. Available filters: id==, view_type_id==, created (>, <, <=, >=, ==, []), print_date (>, <, <=, >=, ==, []), requestor_full_name (==, @@, =@), requestor_email (==, @@, =@)", + schema: new OA\Schema(type: "array", items: new OA\Items(type: "string")), + explode: true + ), + new OA\Parameter( + name: "order", + in: "query", + required: false, + description: "Order by field. Valid fields: id, created, view_type_id, print_date, requestor_full_name, requestor_email", + schema: new OA\Schema(type: "string") + ), + new OA\Parameter( + name: "expand", + in: "query", + required: false, + description: "Expand related entities. Available expansions: requestor, badge, view_type", + schema: new OA\Schema(type: "string") + ), + ], + responses: [ + new OA\Response( + response: Response::HTTP_OK, + description: "Success", + content: new OA\JsonContent(ref: "#/components/schemas/PaginatedSummitAttendeeBadgePrintsResponse") + ), + new OA\Response(response: Response::HTTP_NOT_FOUND, description: "Summit or ticket not found"), + new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"), + new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"), + new OA\Response(response: Response::HTTP_BAD_REQUEST, description: "Invalid filter or order parameter"), + ] + )] public function getAllBySummitAndTicket($summit_id, $ticket_id) { $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); @@ -95,6 +149,52 @@ function ($filter) use ($summit, $ticket_id) { ); } + #[OA\Get( + path: "/api/v1/summits/{id}/tickets/{ticket_id}/badge/current/prints/csv", + summary: "Export badge prints to CSV", + description: "Exports all badge print records for a specific ticket to CSV format. Allows ordering and filtering.", + security: [["oauth2_security_scope" => ["openid", "profile", "email"]]], + tags: ["Summit Badge Prints"], + parameters: [ + new OA\Parameter(ref: "#/components/parameters/summit_id_path_param"), + new OA\Parameter( + name: "ticket_id", + in: "path", + required: true, + description: "Ticket ID", + schema: new OA\Schema(type: "integer") + ), + new OA\Parameter( + name: "filter[]", + in: "query", + required: false, + description: "Filter badge prints. Available filters: id==, view_type_id==, created (>, <, <=, >=, ==, []), print_date (>, <, <=, >=, ==, []), requestor_full_name (==, @@, =@), requestor_email (==, @@, =@)", + schema: new OA\Schema(type: "array", items: new OA\Items(type: "string")), + explode: true + ), + new OA\Parameter( + name: "order", + in: "query", + required: false, + description: "Order by field. Valid fields: id, created, view_type_id, print_date, requestor_full_name, requestor_email", + schema: new OA\Schema(type: "string") + ), + ], + responses: [ + new OA\Response( + response: Response::HTTP_OK, + description: "CSV file", + content: new OA\MediaType( + mediaType: "text/csv", + schema: new OA\Schema(type: "string", format: "binary") + ) + ), + new OA\Response(response: Response::HTTP_NOT_FOUND, description: "Summit or ticket not found"), + new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"), + new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"), + new OA\Response(response: Response::HTTP_BAD_REQUEST, description: "Invalid filter or order parameter"), + ] + )] public function getAllBySummitAndTicketCSV($summit_id, $ticket_id) { $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); @@ -155,11 +255,29 @@ function () { ); } - /** - * @param $summit_id - * @param $ticket_id - * @return \Illuminate\Http\JsonResponse|mixed - */ + #[OA\Delete( + path: "/api/v1/summits/{id}/tickets/{ticket_id}/badge/current/prints", + summary: "Delete all badge prints for a ticket", + description: "Deletes all badge print records for a specific ticket", + security: [["oauth2_security_scope" => ["openid", "profile", "email"]]], + tags: ["Summit Badge Prints"], + parameters: [ + new OA\Parameter(ref: "#/components/parameters/summit_id_path_param"), + new OA\Parameter( + name: "ticket_id", + in: "path", + required: true, + description: "Ticket ID", + schema: new OA\Schema(type: "integer") + ), + ], + responses: [ + new OA\Response(response: Response::HTTP_NO_CONTENT, description: "Badge prints deleted successfully"), + new OA\Response(response: Response::HTTP_NOT_FOUND, description: "Summit or ticket not found"), + new OA\Response(response: Response::HTTP_UNAUTHORIZED, description: "Unauthorized"), + new OA\Response(response: Response::HTTP_FORBIDDEN, description: "Forbidden"), + ] + )] public function deleteBadgePrints($summit_id, $ticket_id) { return $this->processRequest(function () use ($summit_id, $ticket_id) { @@ -171,4 +289,4 @@ public function deleteBadgePrints($summit_id, $ticket_id) return $this->deleted(); }); } -} \ No newline at end of file +} diff --git a/app/Swagger/SummitRegistrationPrintSchemas.php b/app/Swagger/SummitRegistrationPrintSchemas.php index 6b3e2f895..09c98a6a0 100644 --- a/app/Swagger/SummitRegistrationPrintSchemas.php +++ b/app/Swagger/SummitRegistrationPrintSchemas.php @@ -4,4 +4,43 @@ use OpenApi\Attributes as OA; -// +// Badge Print Schemas + +#[OA\Schema( + schema: "SummitAttendeeBadgePrint", + description: "Summit Attendee Badge Print", + properties: [ + new OA\Property(property: "id", type: "integer", example: 1), + new OA\Property(property: "created", type: "integer", format: "int64", description: "Creation timestamp (epoch)", example: 1234567890), + new OA\Property(property: "last_edited", type: "integer", format: "int64", description: "Last edit timestamp (epoch)", example: 1234567890), + new OA\Property(property: "print_date", type: "integer", format: "int64", description: "Print timestamp (epoch)", example: 1234567890), + new OA\Property(property: "requestor_id", type: "integer", description: "ID of the member who requested the print", example: 123), + new OA\Property(property: "badge_id", type: "integer", description: "ID of the badge that was printed", example: 456), + new OA\Property(property: "view_type_id", type: "integer", description: "ID of the badge view type used for printing", example: 789), + new OA\Property(property: "view_type_name", type: "string", description: "Name of the badge view type", example: "Standard Badge"), + ], + type: "object" +)] +class SummitAttendeeBadgePrintSchema +{ +} + +#[OA\Schema( + schema: "PaginatedSummitAttendeeBadgePrintsResponse", + description: "Paginated response for Summit Attendee Badge Prints", + properties: [ + new OA\Property(property: "total", type: "integer", example: 100), + new OA\Property(property: "per_page", type: "integer", example: 15), + new OA\Property(property: "current_page", type: "integer", example: 1), + new OA\Property(property: "last_page", type: "integer", example: 7), + new OA\Property( + property: "data", + type: "array", + items: new OA\Items(ref: "#/components/schemas/SummitAttendeeBadgePrint") + ), + ], + type: "object" +)] +class PaginatedSummitAttendeeBadgePrintsResponseSchema +{ +} diff --git a/update-traces-file.sh b/update-traces-file.sh new file mode 100755 index 000000000..738bc4c4d --- /dev/null +++ b/update-traces-file.sh @@ -0,0 +1 @@ +chmod a+w ./docker-compose/opentelemetry/otel-traces.json From e73fba188883bda772b2c0e3af638c6ca7660bcd Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Mon, 13 Oct 2025 11:44:49 -0300 Subject: [PATCH 2/9] chore: remove file update-traces-file.sh --- update-traces-file.sh | 1 - 1 file changed, 1 deletion(-) delete mode 100755 update-traces-file.sh diff --git a/update-traces-file.sh b/update-traces-file.sh deleted file mode 100755 index 738bc4c4d..000000000 --- a/update-traces-file.sh +++ /dev/null @@ -1 +0,0 @@ -chmod a+w ./docker-compose/opentelemetry/otel-traces.json From 7f95ca508709e50920b6989b69263495e99e7bdc Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Mon, 13 Oct 2025 17:31:49 -0300 Subject: [PATCH 3/9] fix: params --- ...2SummitAttendeeBadgePrintApiController.php | 40 ++++++++++++++++--- 1 file changed, 35 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeeBadgePrintApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeeBadgePrintApiController.php index d98e2a54e..2d4510798 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeeBadgePrintApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeeBadgePrintApiController.php @@ -58,7 +58,27 @@ public function __construct security: [["oauth2_security_scope" => ["openid", "profile", "email"]]], tags: ["Summit Badge Prints"], parameters: [ - new OA\Parameter(ref: "#/components/parameters/summit_id_path_param"), + new OA\Parameter( + name: 'summit_id', + in: 'path', + required: true, + schema: new OA\Schema(type: 'integer'), + description: 'The summit id' + ), + new OA\Parameter( + name: 'page', + in: 'query', + required: false, + schema: new OA\Schema(type: 'integer'), + description: 'The page number' + ), + new OA\Parameter( + name: 'page_size', + in: 'query', + required: false, + schema: new OA\Schema(type: 'integer'), + description: 'The number of pages in each page', + ), new OA\Parameter( name: "ticket_id", in: "path", @@ -66,8 +86,6 @@ public function __construct description: "Ticket ID", schema: new OA\Schema(type: "integer") ), - new OA\Parameter(ref: "#/components/parameters/page_number_param"), - new OA\Parameter(ref: "#/components/parameters/page_size_param"), new OA\Parameter( name: "filter[]", in: "query", @@ -156,7 +174,13 @@ function ($filter) use ($summit, $ticket_id) { security: [["oauth2_security_scope" => ["openid", "profile", "email"]]], tags: ["Summit Badge Prints"], parameters: [ - new OA\Parameter(ref: "#/components/parameters/summit_id_path_param"), + new OA\Parameter( + name: 'summit_id', + in: 'path', + required: true, + schema: new OA\Schema(type: 'integer'), + description: 'The summit id' + ), new OA\Parameter( name: "ticket_id", in: "path", @@ -262,7 +286,13 @@ function () { security: [["oauth2_security_scope" => ["openid", "profile", "email"]]], tags: ["Summit Badge Prints"], parameters: [ - new OA\Parameter(ref: "#/components/parameters/summit_id_path_param"), + new OA\Parameter( + name: 'summit_id', + in: 'path', + required: true, + schema: new OA\Schema(type: 'integer'), + description: 'The summit id' + ), new OA\Parameter( name: "ticket_id", in: "path", From 917888bf827ad859e3199b4c0697910093354ce2 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Tue, 14 Oct 2025 14:51:45 -0300 Subject: [PATCH 4/9] fix: Change "namespace" word positioning --- .../Summit/OAuth2SummitAttendeeBadgePrintApiController.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeeBadgePrintApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeeBadgePrintApiController.php index 2d4510798..5f7987163 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeeBadgePrintApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeeBadgePrintApiController.php @@ -1,4 +1,7 @@ -deleted(); }); } -} +} \ No newline at end of file From cf16e2b2985b98659f6124bcdb1fc016ec105913 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Mon, 10 Nov 2025 20:42:00 +0000 Subject: [PATCH 5/9] fix: security scopes --- ...2SummitAttendeeBadgePrintApiController.php | 103 +++++++++++++----- 1 file changed, 73 insertions(+), 30 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeeBadgePrintApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeeBadgePrintApiController.php index 5f7987163..020cf2d8c 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeeBadgePrintApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeeBadgePrintApiController.php @@ -26,12 +26,34 @@ use utils\Filter; use utils\FilterElement; + +#[OA\SecurityScheme( + type: 'oauth2', + securityScheme: 'OAuth2SummitAttendeeBadgePrintApiController_security_scheme', + flows: [ + new OA\Flow( + authorizationUrl: L5_SWAGGER_CONST_AUTH_URL, + tokenUrl: L5_SWAGGER_CONST_TOKEN_URL, + flow: 'authorizationCode', + scopes: [ + SummitScopes::WriteSummitData => 'Write Summit Data', + SummitScopes::UpdateRegistrationOrders => 'Update Registration Orders', + SummitScopes::ReadAllSummitData => 'Read All Summit Data' + ], + ), + ], +) +] +class RSVPAuthSchema +{ +} + + /** * Class OAuth2SummitAttendeeBadgePrintApiController * @package App\Http\Controllers */ -final class OAuth2SummitAttendeeBadgePrintApiController - extends OAuth2ProtectedController +final class OAuth2SummitAttendeeBadgePrintApiController extends OAuth2ProtectedController { /** * @var ISummitAttendeeBadgePrintService @@ -40,12 +62,11 @@ final class OAuth2SummitAttendeeBadgePrintApiController public function __construct ( - ISummitRepository $summit_repository, + ISummitRepository $summit_repository, ISummitAttendeeBadgePrintRepository $repository, - ISummitAttendeeBadgePrintService $service, - IResourceServerContext $resource_server_context - ) - { + ISummitAttendeeBadgePrintService $service, + IResourceServerContext $resource_server_context + ) { parent::__construct($resource_server_context); $this->repository = $repository; $this->summit_repository = $summit_repository; @@ -58,7 +79,13 @@ public function __construct path: "/api/v1/summits/{id}/tickets/{ticket_id}/badge/current/prints", summary: "Get all badge prints for a ticket", description: "Returns a paginated list of badge print records for a specific ticket. Allows ordering, filtering and pagination.", - security: [["oauth2_security_scope" => ["openid", "profile", "email"]]], + security: [ + [ + "OAuth2SummitAttendeeBadgePrintApiController_security_scheme" => [ + SummitScopes::ReadAllSummitData + ] + ] + ], tags: ["Summit Badge Prints"], parameters: [ new OA\Parameter( @@ -127,25 +154,26 @@ public function __construct public function getAllBySummitAndTicket($summit_id, $ticket_id) { $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); + if (is_null($summit)) + return $this->error404(); return $this->_getAll( function () { return [ - 'id' => ['=='], - 'view_type_id' => ['=='], - 'created' => ['>', '<', '<=', '>=', '==','[]'], - 'print_date' => ['>', '<', '<=', '>=', '==','[]'], - 'requestor_full_name' => ['==','@@','=@'], - 'requestor_email' => ['==','@@','=@'], + 'id' => ['=='], + 'view_type_id' => ['=='], + 'created' => ['>', '<', '<=', '>=', '==', '[]'], + 'print_date' => ['>', '<', '<=', '>=', '==', '[]'], + 'requestor_full_name' => ['==', '@@', '=@'], + 'requestor_email' => ['==', '@@', '=@'], ]; }, function () { return [ 'id' => 'sometimes|integer', 'view_type_id' => 'sometimes|integer', - 'created' => 'sometimes|date_format:U|epoch_seconds', - 'print_date'=> 'sometimes|date_format:U|epoch_seconds', + 'created' => 'sometimes|date_format:U|epoch_seconds', + 'print_date' => 'sometimes|date_format:U|epoch_seconds', 'requestor_full_name' => 'sometimes|string', 'requestor_email' => 'sometimes|string', ]; @@ -174,7 +202,13 @@ function ($filter) use ($summit, $ticket_id) { path: "/api/v1/summits/{id}/tickets/{ticket_id}/badge/current/prints/csv", summary: "Export badge prints to CSV", description: "Exports all badge print records for a specific ticket to CSV format. Allows ordering and filtering.", - security: [["oauth2_security_scope" => ["openid", "profile", "email"]]], + security: [ + [ + "OAuth2SummitAttendeeBadgePrintApiController_security_scheme" => [ + SummitScopes::ReadAllSummitData + ] + ] + ], tags: ["Summit Badge Prints"], parameters: [ new OA\Parameter( @@ -225,25 +259,26 @@ function ($filter) use ($summit, $ticket_id) { public function getAllBySummitAndTicketCSV($summit_id, $ticket_id) { $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find($summit_id); - if (is_null($summit)) return $this->error404(); + if (is_null($summit)) + return $this->error404(); return $this->_getAllCSV( function () { return [ - 'id' => ['=='], - 'view_type_id' => ['=='], - 'created' => ['>', '<', '<=', '>=', '==','[]'], - 'print_date' => ['>', '<', '<=', '>=', '==','[]'], - 'requestor_full_name' => ['==','@@','=@'], - 'requestor_email' => ['==','@@','=@'], + 'id' => ['=='], + 'view_type_id' => ['=='], + 'created' => ['>', '<', '<=', '>=', '==', '[]'], + 'print_date' => ['>', '<', '<=', '>=', '==', '[]'], + 'requestor_full_name' => ['==', '@@', '=@'], + 'requestor_email' => ['==', '@@', '=@'], ]; }, function () { return [ 'id' => 'sometimes|integer', 'view_type_id' => 'sometimes|integer', - 'created' => 'sometimes|date_format:U|epoch_seconds', - 'print_date'=> 'sometimes|date_format:U|epoch_seconds', + 'created' => 'sometimes|date_format:U|epoch_seconds', + 'print_date' => 'sometimes|date_format:U|epoch_seconds', 'requestor_full_name' => 'sometimes|string', 'requestor_email' => 'sometimes|string', ]; @@ -286,7 +321,14 @@ function () { path: "/api/v1/summits/{id}/tickets/{ticket_id}/badge/current/prints", summary: "Delete all badge prints for a ticket", description: "Deletes all badge print records for a specific ticket", - security: [["oauth2_security_scope" => ["openid", "profile", "email"]]], + security: [ + [ + "OAuth2SummitAttendeeBadgePrintApiController_security_scheme" => [ + SummitScopes::WriteSummitData, + SummitScopes::UpdateRegistrationOrders + ] + ] + ], tags: ["Summit Badge Prints"], parameters: [ new OA\Parameter( @@ -315,11 +357,12 @@ public function deleteBadgePrints($summit_id, $ticket_id) { return $this->processRequest(function () use ($summit_id, $ticket_id) { $summit = SummitFinderStrategyFactory::build($this->summit_repository, $this->getResourceServerContext())->find(intval($summit_id)); - if (is_null($summit)) return $this->error404(); + if (is_null($summit)) + return $this->error404(); $this->service->deleteBadgePrintsByTicket($summit, intval($ticket_id)); return $this->deleted(); }); } -} \ No newline at end of file +} From 5f87cdf1fcddf098299349fae2012ed322cd3d16 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Mon, 10 Nov 2025 20:58:22 +0000 Subject: [PATCH 6/9] fix: Add missing dependency --- .../Summit/OAuth2SummitAttendeeBadgePrintApiController.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeeBadgePrintApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeeBadgePrintApiController.php index 020cf2d8c..fceb850fe 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeeBadgePrintApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeeBadgePrintApiController.php @@ -17,6 +17,7 @@ use App\Http\Utils\EpochCellFormatter; use App\Models\Foundation\Summit\Repositories\ISummitAttendeeBadgePrintRepository; +use App\Security\SummitScopes; use Illuminate\Http\Response; use models\oauth2\IResourceServerContext; use models\summit\ISummitRepository; @@ -365,4 +366,4 @@ public function deleteBadgePrints($summit_id, $ticket_id) return $this->deleted(); }); } -} +} \ No newline at end of file From cd5341811bcf650886b74c31a1873b61b4998c5e Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Mon, 10 Nov 2025 21:00:36 +0000 Subject: [PATCH 7/9] fix: Security schema class name to OAuth2SummitAttendeeBadgePrintApiControllerSecurityScheme --- .../OAuth2SummitAttendeeBadgePrintApiController.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeeBadgePrintApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeeBadgePrintApiController.php index fceb850fe..65a20ea9d 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeeBadgePrintApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeeBadgePrintApiController.php @@ -30,7 +30,7 @@ #[OA\SecurityScheme( type: 'oauth2', - securityScheme: 'OAuth2SummitAttendeeBadgePrintApiController_security_scheme', + securityScheme: 'OAuth2SummitAttendeeBadgePrintApiControllerSecurity', flows: [ new OA\Flow( authorizationUrl: L5_SWAGGER_CONST_AUTH_URL, @@ -45,7 +45,7 @@ ], ) ] -class RSVPAuthSchema +class OAuth2SummitAttendeeBadgePrintApiControllerSecurityScheme { } @@ -82,7 +82,7 @@ public function __construct description: "Returns a paginated list of badge print records for a specific ticket. Allows ordering, filtering and pagination.", security: [ [ - "OAuth2SummitAttendeeBadgePrintApiController_security_scheme" => [ + "OAuth2SummitAttendeeBadgePrintApiControllerSecurity" => [ SummitScopes::ReadAllSummitData ] ] @@ -366,4 +366,4 @@ public function deleteBadgePrints($summit_id, $ticket_id) return $this->deleted(); }); } -} \ No newline at end of file +} From bf29f9589482d3af0b79f343bc253913472f4944 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Thu, 13 Nov 2025 21:22:52 +0000 Subject: [PATCH 8/9] chore: Move the security schema for the controller to its own file --- ...2SummitAttendeeBadgePrintApiController.php | 55 ++++++++++--------- .../SummitAttendeeBadgePrintOAuth2Scheme.php | 27 +++++++++ 2 files changed, 56 insertions(+), 26 deletions(-) create mode 100644 app/Swagger/Security/SummitAttendeeBadgePrintOAuth2Scheme.php diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeeBadgePrintApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeeBadgePrintApiController.php index 65a20ea9d..3483ac37c 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeeBadgePrintApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeeBadgePrintApiController.php @@ -16,8 +16,10 @@ **/ use App\Http\Utils\EpochCellFormatter; +use App\Models\Foundation\Main\IGroup; use App\Models\Foundation\Summit\Repositories\ISummitAttendeeBadgePrintRepository; use App\Security\SummitScopes; +use App\Swagger\Security\BadgePrintsAuthSchema; use Illuminate\Http\Response; use models\oauth2\IResourceServerContext; use models\summit\ISummitRepository; @@ -27,29 +29,6 @@ use utils\Filter; use utils\FilterElement; - -#[OA\SecurityScheme( - type: 'oauth2', - securityScheme: 'OAuth2SummitAttendeeBadgePrintApiControllerSecurity', - flows: [ - new OA\Flow( - authorizationUrl: L5_SWAGGER_CONST_AUTH_URL, - tokenUrl: L5_SWAGGER_CONST_TOKEN_URL, - flow: 'authorizationCode', - scopes: [ - SummitScopes::WriteSummitData => 'Write Summit Data', - SummitScopes::UpdateRegistrationOrders => 'Update Registration Orders', - SummitScopes::ReadAllSummitData => 'Read All Summit Data' - ], - ), - ], -) -] -class OAuth2SummitAttendeeBadgePrintApiControllerSecurityScheme -{ -} - - /** * Class OAuth2SummitAttendeeBadgePrintApiController * @package App\Http\Controllers @@ -82,11 +61,19 @@ public function __construct description: "Returns a paginated list of badge print records for a specific ticket. Allows ordering, filtering and pagination.", security: [ [ - "OAuth2SummitAttendeeBadgePrintApiControllerSecurity" => [ + "summit_attendee_badge_print_oauth2" => [ SummitScopes::ReadAllSummitData ] ] ], + x: [ + 'required-groups' => [ + IGroup::SuperAdmins, + IGroup::Administrators, + IGroup::SummitAdministrators, + IGroup::SummitRegistrationAdmins, + ] + ], tags: ["Summit Badge Prints"], parameters: [ new OA\Parameter( @@ -205,11 +192,19 @@ function ($filter) use ($summit, $ticket_id) { description: "Exports all badge print records for a specific ticket to CSV format. Allows ordering and filtering.", security: [ [ - "OAuth2SummitAttendeeBadgePrintApiController_security_scheme" => [ + "summit_attendee_badge_print_oauth2" => [ SummitScopes::ReadAllSummitData ] ] ], + x: [ + 'required-groups' => [ + IGroup::SuperAdmins, + IGroup::Administrators, + IGroup::SummitAdministrators, + IGroup::SummitRegistrationAdmins, + ] + ], tags: ["Summit Badge Prints"], parameters: [ new OA\Parameter( @@ -324,12 +319,20 @@ function () { description: "Deletes all badge print records for a specific ticket", security: [ [ - "OAuth2SummitAttendeeBadgePrintApiController_security_scheme" => [ + "summit_attendee_badge_print_oauth2" => [ SummitScopes::WriteSummitData, SummitScopes::UpdateRegistrationOrders ] ] ], + x: [ + 'required-groups' => [ + IGroup::SuperAdmins, + IGroup::Administrators, + IGroup::SummitAdministrators, + IGroup::SummitRegistrationAdmins, + ] + ], tags: ["Summit Badge Prints"], parameters: [ new OA\Parameter( diff --git a/app/Swagger/Security/SummitAttendeeBadgePrintOAuth2Scheme.php b/app/Swagger/Security/SummitAttendeeBadgePrintOAuth2Scheme.php new file mode 100644 index 000000000..4ff84a652 --- /dev/null +++ b/app/Swagger/Security/SummitAttendeeBadgePrintOAuth2Scheme.php @@ -0,0 +1,27 @@ + 'Write Summit Data', + SummitScopes::UpdateRegistrationOrders => 'Update Registration Orders', + SummitScopes::ReadAllSummitData => 'Read All Summit Data' + ], + ), + ], +) +] +class SummitAttendeeBadgePrintOAuth2Scheme +{ +} From aafbea6f61f0ab11c1924cf10bea79d157dec9e6 Mon Sep 17 00:00:00 2001 From: Matias Perrone Date: Tue, 2 Dec 2025 21:57:58 +0000 Subject: [PATCH 9/9] fix: schema param names and add operationId --- .../OAuth2SummitAttendeeBadgePrintApiController.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeeBadgePrintApiController.php b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeeBadgePrintApiController.php index 3483ac37c..a9c4f8e70 100644 --- a/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeeBadgePrintApiController.php +++ b/app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitAttendeeBadgePrintApiController.php @@ -57,6 +57,7 @@ public function __construct #[OA\Get( path: "/api/v1/summits/{id}/tickets/{ticket_id}/badge/current/prints", + operationId: "getAllBadgePrintsByTicket", summary: "Get all badge prints for a ticket", description: "Returns a paginated list of badge print records for a specific ticket. Allows ordering, filtering and pagination.", security: [ @@ -77,7 +78,7 @@ public function __construct tags: ["Summit Badge Prints"], parameters: [ new OA\Parameter( - name: 'summit_id', + name: 'id', in: 'path', required: true, schema: new OA\Schema(type: 'integer'), @@ -188,6 +189,7 @@ function ($filter) use ($summit, $ticket_id) { #[OA\Get( path: "/api/v1/summits/{id}/tickets/{ticket_id}/badge/current/prints/csv", + operationId: "getAllBadgePrintsByTicketCSV", summary: "Export badge prints to CSV", description: "Exports all badge print records for a specific ticket to CSV format. Allows ordering and filtering.", security: [ @@ -208,7 +210,7 @@ function ($filter) use ($summit, $ticket_id) { tags: ["Summit Badge Prints"], parameters: [ new OA\Parameter( - name: 'summit_id', + name: 'id', in: 'path', required: true, schema: new OA\Schema(type: 'integer'), @@ -315,6 +317,7 @@ function () { #[OA\Delete( path: "/api/v1/summits/{id}/tickets/{ticket_id}/badge/current/prints", + operationId: "deleteBadgePrintsByTicket", summary: "Delete all badge prints for a ticket", description: "Deletes all badge print records for a specific ticket", security: [ @@ -336,7 +339,7 @@ function () { tags: ["Summit Badge Prints"], parameters: [ new OA\Parameter( - name: 'summit_id', + name: 'id', in: 'path', required: true, schema: new OA\Schema(type: 'integer'),