AppServiceProvider.php 9.79 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\Schedules\ScheduleGet\ScheduleGetUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
45
use Source\UseCases\Door\StatusResponse\StatusResponseUseCaseServiceProvider;
46
use Source\UseCases\Schedules\SchedulesGet\SchedulesGetUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
47
48
use Source\UseCases\DoorGroup\GetDoorGroups\GetDoorGroupsUseCaseServiceProvider;
use Source\UseCases\DoorGroup\GetGroupDoors\GetGroupDoorsUseCaseServiceProvider;
49
use Source\UseCases\GroupUser\GetGroupUsers\GetGroupUsersUseCaseServiceProvider;
50
use Source\UseCases\GroupUser\GetUserGroups\GetUserGroupsUseCaseServiceProvider;
51
use Source\UseCases\TokenUser\GetUserTokens\GetUserTokensUseCaseServiceProvider;
52
use Source\UseCases\DoorGroup\AddDoorToGroup\AddDoorToGroupUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
53
use Source\UseCases\GroupUser\AddUserToGroup\AddUserToGroupUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
54
use Source\UseCases\Overrides\OverrideCreate\OverrideCreateUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
55
use Source\UseCases\Schedules\ScheduleCreate\ScheduleCreateUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
56
use Source\UseCases\Schedules\ScheduleUpdate\ScheduleUpdateUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
57
use Source\UseCases\Doors\GenerateDoorToken\GenerateDoorTokenUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
58
59
use Source\UseCases\Entries\GetEntriesForDoor\GetEntriesForDoorUseCaseServiceProvider;
use Source\UseCases\Entries\GetEntriesForUser\GetEntriesForUserUseCaseServiceProvider;
60
use Source\UseCases\Overrides\OverridesForDoor\OverridesForDoorUseCaseServiceProvider;
61
use Source\UseCases\Attempts\GetAttemptsForDoor\GetAttemptsForDoorUseCaseServiceProvider;
62
use Source\UseCases\DoorGroup\RemoveDoorFromGroup\RemoveDoorFromGroupUseCaseServiceProvider;
63
use Source\UseCases\GroupSchedule\SchedulesForGroup\SchedulesForGroupUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
64
use Source\UseCases\GroupUser\RemoveUserFromGroup\RemoveUserFromGroupUseCaseServiceProvider;
65
use Source\UseCases\Entries\GetEntriesForDateRange\GetEntriesForDateRangeUseCaseServiceProvider;
66
use Source\UseCases\Overrides\OverridesForDateRange\OverridesForDateRangeUseCaseServiceProvider;
67
use Source\UseCases\Attempts\GetAttemptCountForDoor\GetAttemptCountForDoorUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
68
use Source\UseCases\Entries\GetEntriesForDoorAndUser\GetEntriesForDoorAndUserUseCaseServiceProvider;
69
use Source\UseCases\GroupSchedule\ActiveSchedulesForGroup\ActiveSchedulesForGroupUseCaseServiceProvider;
70
use Source\UseCases\Door\Authenticate\AuthenticateUseCaseServiceProvider as DoorAuthenticateUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
71
use Source\UseCases\Users\Authenticate\AuthenticateUseCaseServiceProvider as UserAuthenticateUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
72
use Source\UseCases\Token\Authenticate\AuthenticateUseCaseServiceProvider as TokenAuthenticateUseCaseServiceProvider;
73
74
75

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

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

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

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

121
        // DoorGroup
122
        GetDoorGroupsUseCaseServiceProvider::class,
123
        GetGroupDoorsUseCaseServiceProvider::class,
124
        AddDoorToGroupUseCaseServiceProvider::class,
125
        RemoveDoorFromGroupUseCaseServiceProvider::class,
126

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

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

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

        // TokenUser
        GetUserTokensUseCaseServiceProvider::class,
151
152
153
154
155

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

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

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

        // DoorUser
        DoorUserGroupMapUseCaseServiceProvider::class,
173
174
175
176
177

        // Overrides
        OverrideCreateUseCaseServiceProvider::class,
        OverridesForDoorUseCaseServiceProvider::class,
        OverridesForDateRangeUseCaseServiceProvider::class,
178
179
    ];

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

        foreach ($this->useCaseProviders as $useCaseProvider) {
            $this->app->registerDeferredProvider($useCaseProvider);
        }
197
198
199
200
201
202
203
204
205
206
207
208
    }

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