Skip to content

Commit b10ef03

Browse files
committed
chore: Redefine scopes to remove %s string and add L5_SWAGGER_CONST_HOST config variable
Signed-off-by: Matias Perrone <github@matiasperrone.com>
1 parent a87252f commit b10ef03

10 files changed

Lines changed: 277 additions & 2 deletions

app/Http/Controllers/Apis/Protected/Summit/OAuth2SummitBadgesApiController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* limitations under the License.
1616
**/
1717
use App\Models\Foundation\Summit\Repositories\ISummitAttendeeBadgeRepository;
18-
use App\Security\SummitScopes;
18+
use App\Swagger\schemas\SummitScopes;
1919
use models\oauth2\IResourceServerContext;
2020
use models\summit\ISummitRepository;
2121
use ModelSerializers\SerializerRegistry;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php namespace App\Security;
2+
/**
3+
* Copyright 2020 OpenStack Foundation
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
* Unless required by applicable law or agreed to in writing, software
9+
* distributed under the License is distributed on an "AS IS" BASIS,
10+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
* See the License for the specific language governing permissions and
12+
* limitations under the License.
13+
**/
14+
15+
/**
16+
* Class CompanyScopes
17+
* @package App\Security
18+
*/
19+
final class CompanyScopes
20+
{
21+
const Read = L5_SWAGGER_CONST_HOST . '/companies/read';
22+
const Write = L5_SWAGGER_CONST_HOST . '/companies/write';
23+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php namespace App\Security;
2+
/**
3+
* Copyright 2021 OpenStack Foundation
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
* Unless required by applicable law or agreed to in writing, software
9+
* distributed under the License is distributed on an "AS IS" BASIS,
10+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
* See the License for the specific language governing permissions and
12+
* limitations under the License.
13+
**/
14+
15+
/**
16+
* Class ElectionScopes
17+
* @package App\Security
18+
*/
19+
final class ElectionScopes
20+
{
21+
const ReadAllElections = 'elections/read'; // read all elections
22+
const WriteMyCandidateProfile = 'elections/candidates/write/me';
23+
const NominatesCandidates = 'elections/candidates/nominate';
24+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php namespace App\Security;
2+
/**
3+
* Copyright 2021 OpenStack Foundation
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
* Unless required by applicable law or agreed to in writing, software
9+
* distributed under the License is distributed on an "AS IS" BASIS,
10+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
* See the License for the specific language governing permissions and
12+
* limitations under the License.
13+
**/
14+
15+
class GroupsScopes
16+
{
17+
const ReadData = L5_SWAGGER_CONST_HOST . '/groups/read';
18+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php namespace App\Security;
2+
/**
3+
* Copyright 2018 OpenStack Foundation
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
* Unless required by applicable law or agreed to in writing, software
9+
* distributed under the License is distributed on an "AS IS" BASIS,
10+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
* See the License for the specific language governing permissions and
12+
* limitations under the License.
13+
**/
14+
15+
/**
16+
* Class MemberScopes
17+
* @package App\Security
18+
*/
19+
final class MemberScopes
20+
{
21+
const ReadMemberData = L5_SWAGGER_CONST_HOST . '/members/read';
22+
23+
const ReadMyMemberData = L5_SWAGGER_CONST_HOST . '/members/read/me';
24+
25+
const WriteMemberData = L5_SWAGGER_CONST_HOST . '/members/write';
26+
27+
const WriteMyMemberData = L5_SWAGGER_CONST_HOST . '/members/write/me';
28+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php namespace App\Security;
2+
/**
3+
* Copyright 2018 OpenStack Foundation
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
* Unless required by applicable law or agreed to in writing, software
9+
* distributed under the License is distributed on an "AS IS" BASIS,
10+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
* See the License for the specific language governing permissions and
12+
* limitations under the License.
13+
**/
14+
15+
/**
16+
* Class OrganizationScopes
17+
* @package App\Security
18+
*/
19+
final class OrganizationScopes
20+
{
21+
const ReadOrganizationData = L5_SWAGGER_CONST_HOST . '/organizations/read';
22+
const WriteOrganizationData = L5_SWAGGER_CONST_HOST . '/organizations/write';
23+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
namespace App\Security;
4+
5+
class RSVPInvitationsScopes
6+
{
7+
public const string Read = 'rsvp-invitations/read'; // read all elections
8+
public const string Write = 'rsvp-invitations/write';
9+
public const string Send = 'rsvp-invitations/send';
10+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php namespace App\Security;
2+
/**
3+
* Copyright 2020 OpenStack Foundation
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
* http://www.apache.org/licenses/LICENSE-2.0
8+
* Unless required by applicable law or agreed to in writing, software
9+
* distributed under the License is distributed on an "AS IS" BASIS,
10+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
* See the License for the specific language governing permissions and
12+
* limitations under the License.
13+
**/
14+
15+
/**
16+
* Class SponsoredProjectScope
17+
* @package App\Security
18+
*/
19+
final class SponsoredProjectScope
20+
{
21+
const Read = L5_SWAGGER_CONST_HOST . '/sponsored-projects/read';
22+
const Write = L5_SWAGGER_CONST_HOST . '/sponsored-projects/write';
23+
}
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
<?php
2+
namespace App\Swagger\schemas;
3+
/**
4+
* Copyright 2017 OpenStack Foundation
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
* Unless required by applicable law or agreed to in writing, software
10+
* distributed under the License is distributed on an "AS IS" BASIS,
11+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
* See the License for the specific language governing permissions and
13+
* limitations under the License.
14+
**/
15+
16+
/**
17+
* Class SummitScopes
18+
* @package App\Security
19+
*/
20+
final class SummitScopes
21+
{
22+
const ReadSummitData = L5_SWAGGER_CONST_HOST . '/summits/read';
23+
const ReadAllSummitData = L5_SWAGGER_CONST_HOST . '/summits/read/all';
24+
25+
// me
26+
const MeRead = L5_SWAGGER_CONST_HOST . '/me/read';
27+
const AddMyFavorites = L5_SWAGGER_CONST_HOST . '/me/summits/events/favorites/add';
28+
const DeleteMyFavorites = L5_SWAGGER_CONST_HOST . '/me/summits/events/favorites/delete';
29+
const AddMyRSVP = L5_SWAGGER_CONST_HOST . '/me/summits/events/rsvp/add';
30+
const DeleteMyRSVP = L5_SWAGGER_CONST_HOST . '/me/summits/events/rsvp/delete';
31+
const AddMySchedule = L5_SWAGGER_CONST_HOST . '/me/summits/events/schedule/add';
32+
const DeleteMySchedule = L5_SWAGGER_CONST_HOST . '/me/summits/events/schedule/delete';
33+
const AddMyEventFeedback = L5_SWAGGER_CONST_HOST . '/me/summits/events/feedback/add';
34+
const DeleteMyEventFeedback = L5_SWAGGER_CONST_HOST . '/me/summits/events/feedback/delete';
35+
const AddMyScheduleShareable = L5_SWAGGER_CONST_HOST . '/me/summits/events/schedule/shareable/add';
36+
const DeleteMyScheduleShareable = L5_SWAGGER_CONST_HOST . '/me/summits/events/schedule/shareable/delete';
37+
const SendMyScheduleMail = L5_SWAGGER_CONST_HOST . '/me/summits/events/schedule/mail';
38+
const EnterEvent = L5_SWAGGER_CONST_HOST . '/me/summits/events/enter';
39+
const LeaveEvent = L5_SWAGGER_CONST_HOST . '/me/summits/events/leave';
40+
const WriteMetrics = L5_SWAGGER_CONST_HOST . '/me/summits/metrics/write';
41+
const ReadMetrics = L5_SWAGGER_CONST_HOST . '/me/summits/metrics/read';
42+
43+
// registration
44+
const CreateRegistrationOrders = L5_SWAGGER_CONST_HOST . '/summits/registration-orders/create';
45+
const CreateOfflineRegistrationOrders = L5_SWAGGER_CONST_HOST . '/summits/registration-orders/create/offline';
46+
const UpdateRegistrationOrders = L5_SWAGGER_CONST_HOST . '/summits/registration-orders/update';
47+
const UpdateRegistrationOrdersBadges = L5_SWAGGER_CONST_HOST . '/summits/registration-orders/badges/update';
48+
const PrintRegistrationOrdersBadges = L5_SWAGGER_CONST_HOST . '/summits/registration-orders/badges/print';
49+
const UpdateMyRegistrationOrders = L5_SWAGGER_CONST_HOST . '/summits/registration-orders/update/me';
50+
const DeleteRegistrationOrders = L5_SWAGGER_CONST_HOST . '/summits/registration-orders/delete';
51+
const DeleteMyRegistrationOrders = L5_SWAGGER_CONST_HOST . '/summits/registration-orders/delete/me';
52+
const ReadMyRegistrationOrders = L5_SWAGGER_CONST_HOST . '/summits/registration-orders/read/me';
53+
const ReadRegistrationOrders = L5_SWAGGER_CONST_HOST . '/summits/registration-orders/read';
54+
const WriteBadgeScan = L5_SWAGGER_CONST_HOST . '/summits/badge-scans/write';
55+
const WriteMyBadgeScan = L5_SWAGGER_CONST_HOST . '/summits/badge-scans/write/me';
56+
const ReadBadgeScan = L5_SWAGGER_CONST_HOST . '/summits/badge-scans/read';
57+
58+
const ReadBadgeScanValidate = L5_SWAGGER_CONST_HOST . '/summits/badge-scans/validate';
59+
const ReadMyBadgeScan = L5_SWAGGER_CONST_HOST . '/summits/badge-scans/read/me';
60+
const WriteRegistrationData = L5_SWAGGER_CONST_HOST . '/summits/registration/write';
61+
const ReadPaymentProfiles = L5_SWAGGER_CONST_HOST . '/summits/payment-gateway-profiles/read';
62+
const WritePaymentProfiles = L5_SWAGGER_CONST_HOST . '/summits/payment-gateway-profiles/write';
63+
const WriteRegistrationInvitations = L5_SWAGGER_CONST_HOST . '/summits/registration-invitations/write';
64+
const ReadRegistrationInvitations = L5_SWAGGER_CONST_HOST . '/summits/registration-invitations/read';
65+
const WriteSubmissionInvitations = L5_SWAGGER_CONST_HOST . '/summits/submission-invitations/write';
66+
const ReadSubmissionInvitations = L5_SWAGGER_CONST_HOST . '/summits/submission-invitations/read';
67+
68+
const ReadMyRegistrationInvitations = L5_SWAGGER_CONST_HOST . '/summits/registration-invitations/read/me';
69+
const DoVirtualCheckIn = L5_SWAGGER_CONST_HOST . '/summits/registration/virtual-checkin';
70+
// bookable rooms
71+
const ReadBookableRoomsData = L5_SWAGGER_CONST_HOST . '/bookable-rooms/read';
72+
const WriteMyBookableRoomsReservationData = L5_SWAGGER_CONST_HOST . '/bookable-rooms/my-reservations/write';
73+
const ReadMyBookableRoomsReservationData = L5_SWAGGER_CONST_HOST . '/bookable-rooms/my-reservations/read';
74+
const BookableRoomsReservation = L5_SWAGGER_CONST_HOST . '/bookable-rooms/reserve';
75+
const WriteBookableRoomsData = L5_SWAGGER_CONST_HOST . '/bookable-rooms/write';
76+
77+
const ReadNotifications = L5_SWAGGER_CONST_HOST . '/summits/read-notifications';
78+
const WriteNotifications = L5_SWAGGER_CONST_HOST . '/summits/write-notifications';
79+
80+
const WriteSummitData = L5_SWAGGER_CONST_HOST . '/summits/write';
81+
const WriteSpeakersData = L5_SWAGGER_CONST_HOST . '/speakers/write';
82+
const ReadSpeakersData = L5_SWAGGER_CONST_HOST . '/speakers/read';
83+
const WriteTrackTagGroupsData = L5_SWAGGER_CONST_HOST . '/track-tag-groups/write';
84+
const WriteTrackQuestionTemplateData = L5_SWAGGER_CONST_HOST . '/track-question-templates/write';
85+
const WriteMySpeakersData = L5_SWAGGER_CONST_HOST . '/speakers/write/me';
86+
const ReadMySpeakersData = L5_SWAGGER_CONST_HOST . '/speakers/read/me';
87+
88+
const PublishEventData = L5_SWAGGER_CONST_HOST . '/summits/publish-event';
89+
const WriteEventData = L5_SWAGGER_CONST_HOST . '/summits/write-event';
90+
const WriteVideoData = L5_SWAGGER_CONST_HOST . '/summits/write-videos';
91+
const WritePresentationVideosData = L5_SWAGGER_CONST_HOST . '/summits/write-presentation-videos';
92+
const WritePresentationLinksData = L5_SWAGGER_CONST_HOST . '/summits/write-presentation-links';
93+
const WritePresentationSlidesData = L5_SWAGGER_CONST_HOST . '/summits/write-presentation-slides';
94+
const WritePresentationMaterialsData = L5_SWAGGER_CONST_HOST . '/summits/write-presentation-materials';
95+
96+
const WriteAttendeesData = L5_SWAGGER_CONST_HOST . '/attendees/write';
97+
const WritePromoCodeData = L5_SWAGGER_CONST_HOST . '/promo-codes/write';
98+
const WriteEventTypeData = L5_SWAGGER_CONST_HOST . '/event-types/write';
99+
const WriteTracksData = L5_SWAGGER_CONST_HOST . '/tracks/write';
100+
const WriteTrackGroupsData = L5_SWAGGER_CONST_HOST . '/track-groups/write';
101+
const WriteLocationsData = L5_SWAGGER_CONST_HOST . '/locations/write';
102+
const WriteRSVPTemplateData = L5_SWAGGER_CONST_HOST . '/rsvp-templates/write';
103+
const WriteLocationBannersData = L5_SWAGGER_CONST_HOST . '/locations/banners/write';
104+
const WriteSummitSpeakerAssistanceData = L5_SWAGGER_CONST_HOST . '/summit-speaker-assistance/write';
105+
const WriteTicketTypeData = L5_SWAGGER_CONST_HOST . '/ticket-types/write';
106+
const WritePresentationData = L5_SWAGGER_CONST_HOST . '/summits/write-presentation';
107+
108+
const WriteTagsData = L5_SWAGGER_CONST_HOST . '/tags/write';
109+
const ReadTagsData = L5_SWAGGER_CONST_HOST . '/tags/read';
110+
111+
const ReadSummitAdminGroups = L5_SWAGGER_CONST_HOST . '/summit-administrator-groups/read';
112+
const WriteSummitAdminGroups = L5_SWAGGER_CONST_HOST . '/summit-administrator-groups/write';
113+
114+
const ReadSummitMediaFileTypes = L5_SWAGGER_CONST_HOST . '/summit-media-file-types/read';
115+
const WriteSummitMediaFileTypes = L5_SWAGGER_CONST_HOST . '/summit-media-file-types/write';
116+
117+
const Allow2PresentationAttendeeVote = L5_SWAGGER_CONST_HOST . '/presentations/attendee-vote';
118+
119+
const ReadAuditLogs = L5_SWAGGER_CONST_HOST . '/audit-logs/read';
120+
121+
const WriteAttendeeNotesData = L5_SWAGGER_CONST_HOST . '/attendee/notes/write';
122+
const ReadAttendeeNotesData = L5_SWAGGER_CONST_HOST . '/attendee/notes/read';
123+
124+
const WriteSummitsConfirmExternalOrders = L5_SWAGGER_CONST_HOST . '/summits/confirm-external-orders';
125+
const ReadSummitsConfirmExternalOrders = L5_SWAGGER_CONST_HOST . '/summits/read-external-orders';
126+
}
127+

app/Swagger/Security/SummitBadgesOauth2Schema.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace App\Swagger\schemas;
44

5-
use App\Security\SummitScopes;
65
use OpenApi\Attributes as OA;
76

87
#[OA\SecurityScheme(

0 commit comments

Comments
 (0)