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

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

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

112
113
114
        // DoorUser
        UserDoorAccessUseCaseServiceProvider::class,

Jacob Priddy's avatar
Jacob Priddy committed
115
        // Groups
Jacob Priddy's avatar
Jacob Priddy committed
116
        GetGroupUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
117
        CreateGroupUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
118
        DeleteGroupUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
119
        UpdateGroupUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
120
        GetAllGroupsUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
121

Jacob Priddy's avatar
Jacob Priddy committed
122
        // GroupUser
123
        GetUserGroupsUseCaseServiceProvider::class,
124
        GetGroupUsersUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
125
126
127
        AddUserToGroupUseCaseServiceProvider::class,
        RemoveUserFromGroupUseCaseServiceProvider::class,

128
        // DoorGroup
129
        GetDoorGroupsUseCaseServiceProvider::class,
130
        GetGroupDoorsUseCaseServiceProvider::class,
131
        AddDoorToGroupUseCaseServiceProvider::class,
132
        RemoveDoorFromGroupUseCaseServiceProvider::class,
133

134
135
        // Door
        AccessUseCaseServiceProvider::class,
136
        UpdateBinaryUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
137
138
        StatusResponseUseCaseServiceProvider::class,
        DoorAuthenticateUseCaseServiceProvider::class,
139

Jacob Priddy's avatar
Jacob Priddy committed
140
        // Doors
141
        GetDoorUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
142
        CreateDoorUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
143
        DeleteDoorUseCaseServiceProvider::class,
144
        UpdateDoorUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
145
        GetAllDoorsUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
146
        UserAuthenticateUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
147
        GenerateDoorTokenUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
148
149

        // Tokens
150
        GetTokenUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
151
152
        CreateTokenUseCaseServiceProvider::class,
        ExpireTokenUseCaseServiceProvider::class,
153
154
        UpdateTokenUseCaseServiceProvider::class,
        GetAllTokensUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
155
        TokenAuthenticateUseCaseServiceProvider::class,
156
157
158

        // TokenUser
        GetUserTokensUseCaseServiceProvider::class,
159
160
161

        // Attempts
        GetAttemptsUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
162
163
164
165

        // Entries
        GetEntriesForDoorUseCaseServiceProvider::class,
        GetEntriesForUserUseCaseServiceProvider::class,
166
        GetEntriesForDateRangeUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
167
        GetEntriesForDoorAndUserUseCaseServiceProvider::class,
168
169

        // Schedule
170
171
        ScheduleGetUseCaseServiceProvider::class,
        SchedulesGetUseCaseServiceProvider::class,
172
        ScheduleCreateUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
173
        ScheduleUpdateUseCaseServiceProvider::class,
174
175
        SchedulesForGroupUseCaseServiceProvider::class,
        ActiveSchedulesForGroupUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
176

177
        // Overrides
178
        OverrideGetUseCaseServiceProvider::class,
179
        OverrideCreateUseCaseServiceProvider::class,
180
        OverrideUpdateUseCaseServiceProvider::class,
181
182
        OverridesForDoorUseCaseServiceProvider::class,
        OverridesForDateRangeUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
183
184
185

        // Commands
        CommandServiceProvider::class,
186
187
    ];

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

        foreach ($this->useCaseProviders as $useCaseProvider) {
            $this->app->registerDeferredProvider($useCaseProvider);
        }
205
206
207
208
209
210
211
212
213
214
215
216
    }

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