AppServiceProvider.php 10 KB
Newer Older
1
2
3
4
5
<?php

namespace App\Providers;

use Illuminate\Support\ServiceProvider;
6
use Source\Authorization\AuthorizerServiceProvider;
7
use Source\Gateways\Saml\SamlRepositoryServiceProvider;
8
use Source\Gateways\Doors\DoorsRepositoryServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
9
use Source\Gateways\Users\UsersRepositoryServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
10
use Source\Gateways\Groups\GroupsRepositoryServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
11
use Source\Gateways\Tokens\TokensRepositoryServiceProvider;
12
use Source\Gateways\Entries\EntriesRepositoryServiceProvider;
13
use Source\UseCases\Door\Access\AccessUseCaseServiceProvider;
14
use Source\Gateways\Attempts\AttemptsRepositoryServiceProvider;
15
use Source\Gateways\DoorUser\DoorUserRepositoryServiceProvider;
16
use Source\UseCases\Doors\GetDoor\GetDoorUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
17
use Source\UseCases\Users\GetUser\GetUserUseCaseServiceProvider;
18
use Source\Gateways\DoorGroup\DoorGroupRepositoryServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
19
use Source\Gateways\GroupUser\GroupUserRepositoryServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
20
use Source\Gateways\Overrides\OverridesRepositoryServiceProvider;
21
use Source\Gateways\Schedules\SchedulesRepositoryServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
22
use Source\UseCases\Groups\GetGroup\GetGroupUseCaseServiceProvider;
23
use Source\UseCases\Tokens\GetToken\GetTokenUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
24
25
26
use Source\UseCases\Doors\CreateDoor\CreateDoorUseCaseServiceProvider;
use Source\UseCases\Doors\DeleteDoor\DeleteDoorUseCaseServiceProvider;
use Source\UseCases\Doors\UpdateDoor\UpdateDoorUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
27
use Source\UseCases\Users\CreateUser\CreateUserUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
28
use Source\UseCases\Users\DeleteUser\DeleteUserUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
29
use Source\UseCases\Users\UpdateUser\UpdateUserUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
30
use Source\Gateways\DoorSchedule\DoorScheduleRepositoryServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
31
use Source\UseCases\Doors\GetAllDoors\GetAllDoorsUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
32
use Source\UseCases\Users\GetAllUsers\GetAllUsersUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
33
34
use Source\Gateways\RecurrenceSet\RecurrenceSetRepositoryServiceProvider;
use Source\UseCases\DoorUserGroup\DoorUserGroupMapUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
35
use Source\UseCases\Groups\CreateGroup\CreateGroupUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
36
use Source\UseCases\Groups\DeleteGroup\DeleteGroupUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
37
use Source\UseCases\Groups\UpdateGroup\UpdateGroupUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
38
39
use Source\UseCases\Tokens\CreateToken\CreateTokenUseCaseServiceProvider;
use Source\UseCases\Tokens\ExpireToken\ExpireTokenUseCaseServiceProvider;
40
use Source\UseCases\Tokens\UpdateToken\UpdateTokenUseCaseServiceProvider;
41
use Source\UseCases\Attempts\GetAttempts\GetAttemptsUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
42
use Source\UseCases\Groups\GetAllGroups\GetAllGroupsUseCaseServiceProvider;
43
use Source\UseCases\Tokens\GetAllTokens\GetAllTokensUseCaseServiceProvider;
44
use Source\UseCases\Overrides\OverrideGet\OverrideGetUseCaseServiceProvider;
45
use Source\UseCases\Schedules\ScheduleGet\ScheduleGetUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
46
use Source\UseCases\Door\StatusResponse\StatusResponseUseCaseServiceProvider;
47
use Source\UseCases\Schedules\SchedulesGet\SchedulesGetUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
48
49
use Source\UseCases\DoorGroup\GetDoorGroups\GetDoorGroupsUseCaseServiceProvider;
use Source\UseCases\DoorGroup\GetGroupDoors\GetGroupDoorsUseCaseServiceProvider;
50
use Source\UseCases\GroupUser\GetGroupUsers\GetGroupUsersUseCaseServiceProvider;
51
use Source\UseCases\GroupUser\GetUserGroups\GetUserGroupsUseCaseServiceProvider;
52
use Source\UseCases\TokenUser\GetUserTokens\GetUserTokensUseCaseServiceProvider;
53
use Source\UseCases\DoorGroup\AddDoorToGroup\AddDoorToGroupUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
54
use Source\UseCases\GroupUser\AddUserToGroup\AddUserToGroupUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
55
use Source\UseCases\Overrides\OverrideCreate\OverrideCreateUseCaseServiceProvider;
56
use Source\UseCases\Overrides\OverrideUpdate\OverrideUpdateUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
57
use Source\UseCases\Schedules\ScheduleCreate\ScheduleCreateUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
58
use Source\UseCases\Schedules\ScheduleUpdate\ScheduleUpdateUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
59
use Source\UseCases\Doors\GenerateDoorToken\GenerateDoorTokenUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
60
61
use Source\UseCases\Entries\GetEntriesForDoor\GetEntriesForDoorUseCaseServiceProvider;
use Source\UseCases\Entries\GetEntriesForUser\GetEntriesForUserUseCaseServiceProvider;
62
use Source\UseCases\Overrides\OverridesForDoor\OverridesForDoorUseCaseServiceProvider;
63
use Source\UseCases\Attempts\GetAttemptsForDoor\GetAttemptsForDoorUseCaseServiceProvider;
64
use Source\UseCases\DoorGroup\RemoveDoorFromGroup\RemoveDoorFromGroupUseCaseServiceProvider;
65
use Source\UseCases\GroupSchedule\SchedulesForGroup\SchedulesForGroupUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
66
use Source\UseCases\GroupUser\RemoveUserFromGroup\RemoveUserFromGroupUseCaseServiceProvider;
67
use Source\UseCases\Entries\GetEntriesForDateRange\GetEntriesForDateRangeUseCaseServiceProvider;
68
use Source\UseCases\Overrides\OverridesForDateRange\OverridesForDateRangeUseCaseServiceProvider;
69
use Source\UseCases\Attempts\GetAttemptCountForDoor\GetAttemptCountForDoorUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
70
use Source\UseCases\Entries\GetEntriesForDoorAndUser\GetEntriesForDoorAndUserUseCaseServiceProvider;
71
use Source\UseCases\GroupSchedule\ActiveSchedulesForGroup\ActiveSchedulesForGroupUseCaseServiceProvider;
72
use Source\UseCases\Door\Authenticate\AuthenticateUseCaseServiceProvider as DoorAuthenticateUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
73
use Source\UseCases\Users\Authenticate\AuthenticateUseCaseServiceProvider as UserAuthenticateUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
74
use Source\UseCases\Token\Authenticate\AuthenticateUseCaseServiceProvider as TokenAuthenticateUseCaseServiceProvider;
75
76
77

class AppServiceProvider extends ServiceProvider
{
78
79
80
81
    /**
     * @var string[]
     */
    protected array $gatewayProviders = [
82
        AuthorizerServiceProvider::class,
83
        SamlRepositoryServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
84
        UsersRepositoryServiceProvider::class,
85
        DoorsRepositoryServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
86
        TokensRepositoryServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
87
        GroupsRepositoryServiceProvider::class,
88
89
        EntriesRepositoryServiceProvider::class,
        AttemptsRepositoryServiceProvider::class,
90
        DoorUserRepositoryServiceProvider::class,
91
        SchedulesRepositoryServiceProvider::class,
92
        DoorGroupRepositoryServiceProvider::class,
93
        GroupUserRepositoryServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
94
        OverridesRepositoryServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
95
        DoorScheduleRepositoryServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
96
        RecurrenceSetRepositoryServiceProvider::class,
97
98
99
100
101
102
    ];

    /**
     * @var string[]
     */
    protected array $useCaseProviders = [
Jacob Priddy's avatar
Jacob Priddy committed
103
        // Users
Jacob Priddy's avatar
Jacob Priddy committed
104
        GetUserUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
105
        DeleteUserUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
106
        UpdateUserUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
107
        CreateUserUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
108
        GetAllUsersUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
109

Jacob Priddy's avatar
Jacob Priddy committed
110
        // Groups
Jacob Priddy's avatar
Jacob Priddy committed
111
        GetGroupUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
112
        CreateGroupUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
113
        DeleteGroupUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
114
        UpdateGroupUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
115
        GetAllGroupsUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
116

Jacob Priddy's avatar
Jacob Priddy committed
117
        // GroupUser
118
        GetUserGroupsUseCaseServiceProvider::class,
119
        GetGroupUsersUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
120
121
122
        AddUserToGroupUseCaseServiceProvider::class,
        RemoveUserFromGroupUseCaseServiceProvider::class,

123
        // DoorGroup
124
        GetDoorGroupsUseCaseServiceProvider::class,
125
        GetGroupDoorsUseCaseServiceProvider::class,
126
        AddDoorToGroupUseCaseServiceProvider::class,
127
        RemoveDoorFromGroupUseCaseServiceProvider::class,
128

129
130
        // Door
        AccessUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
131
132
        StatusResponseUseCaseServiceProvider::class,
        DoorAuthenticateUseCaseServiceProvider::class,
133

Jacob Priddy's avatar
Jacob Priddy committed
134
        // Doors
135
        GetDoorUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
136
        CreateDoorUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
137
        DeleteDoorUseCaseServiceProvider::class,
138
        UpdateDoorUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
139
        GetAllDoorsUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
140
        UserAuthenticateUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
141
        GenerateDoorTokenUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
142
143

        // Tokens
144
        GetTokenUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
145
146
        CreateTokenUseCaseServiceProvider::class,
        ExpireTokenUseCaseServiceProvider::class,
147
148
        UpdateTokenUseCaseServiceProvider::class,
        GetAllTokensUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
149
        TokenAuthenticateUseCaseServiceProvider::class,
150
151
152

        // TokenUser
        GetUserTokensUseCaseServiceProvider::class,
153
154
155
156
157

        // Attempts
        GetAttemptsUseCaseServiceProvider::class,
        GetAttemptsForDoorUseCaseServiceProvider::class,
        GetAttemptCountForDoorUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
158
159
160
161

        // Entries
        GetEntriesForDoorUseCaseServiceProvider::class,
        GetEntriesForUserUseCaseServiceProvider::class,
162
        GetEntriesForDateRangeUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
163
        GetEntriesForDoorAndUserUseCaseServiceProvider::class,
164
165

        // Schedule
166
167
        ScheduleGetUseCaseServiceProvider::class,
        SchedulesGetUseCaseServiceProvider::class,
168
        ScheduleCreateUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
169
        ScheduleUpdateUseCaseServiceProvider::class,
170
171
        SchedulesForGroupUseCaseServiceProvider::class,
        ActiveSchedulesForGroupUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
172
173
174

        // DoorUser
        DoorUserGroupMapUseCaseServiceProvider::class,
175
176

        // Overrides
177
        OverrideGetUseCaseServiceProvider::class,
178
        OverrideCreateUseCaseServiceProvider::class,
179
        OverrideUpdateUseCaseServiceProvider::class,
180
181
        OverridesForDoorUseCaseServiceProvider::class,
        OverridesForDateRangeUseCaseServiceProvider::class,
182
183
    ];

184
185
186
187
188
189
190
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
191
        // We register gateways first, as use cases will generally use gateways
192
193
        // Not that it actually matters because they are all deferred anyway
        // and will all be registered before any need to be created.
194
195
196
197
198
199
200
        foreach ($this->gatewayProviders as $gatewayProvider) {
            $this->app->registerDeferredProvider($gatewayProvider);
        }

        foreach ($this->useCaseProviders as $useCaseProvider) {
            $this->app->registerDeferredProvider($useCaseProvider);
        }
201
202
203
204
205
206
207
208
209
210
211
212
    }

    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        //
    }
}