AppServiceProvider.php 7.54 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\UseCases\Groups\GetGroup\GetGroupUseCaseServiceProvider;
21
use Source\UseCases\Tokens\GetToken\GetTokenUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
22
23
24
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
25
use Source\UseCases\Users\CreateUser\CreateUserUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
26
use Source\UseCases\Users\DeleteUser\DeleteUserUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
27
use Source\UseCases\Users\UpdateUser\UpdateUserUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
28
use Source\UseCases\Doors\GetAllDoors\GetAllDoorsUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
29
use Source\UseCases\Users\GetAllUsers\GetAllUsersUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
30
use Source\UseCases\Groups\CreateGroup\CreateGroupUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
31
use Source\UseCases\Groups\DeleteGroup\DeleteGroupUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
32
use Source\UseCases\Groups\UpdateGroup\UpdateGroupUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
33
34
use Source\UseCases\Tokens\CreateToken\CreateTokenUseCaseServiceProvider;
use Source\UseCases\Tokens\ExpireToken\ExpireTokenUseCaseServiceProvider;
35
use Source\UseCases\Tokens\UpdateToken\UpdateTokenUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
36
use Source\UseCases\Token\Authenticate\AuthenticateUseCaseServiceProvider;
37
use Source\UseCases\Attempts\GetAttempts\GetAttemptsUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
38
use Source\UseCases\Groups\GetAllGroups\GetAllGroupsUseCaseServiceProvider;
39
use Source\UseCases\Tokens\GetAllTokens\GetAllTokensUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
40
41
use Source\UseCases\DoorGroup\GetDoorGroups\GetDoorGroupsUseCaseServiceProvider;
use Source\UseCases\DoorGroup\GetGroupDoors\GetGroupDoorsUseCaseServiceProvider;
42
use Source\UseCases\GroupUser\GetGroupUsers\GetGroupUsersUseCaseServiceProvider;
43
use Source\UseCases\GroupUser\GetUserGroups\GetUserGroupsUseCaseServiceProvider;
44
use Source\UseCases\TokenUser\GetUserTokens\GetUserTokensUseCaseServiceProvider;
45
use Source\UseCases\DoorGroup\AddDoorToGroup\AddDoorToGroupUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
46
use Source\UseCases\GroupUser\AddUserToGroup\AddUserToGroupUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
47
use Source\UseCases\Doors\GenerateDoorToken\GenerateDoorTokenUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
48
49
use Source\UseCases\Entries\GetEntriesForDoor\GetEntriesForDoorUseCaseServiceProvider;
use Source\UseCases\Entries\GetEntriesForUser\GetEntriesForUserUseCaseServiceProvider;
50
use Source\UseCases\Attempts\GetAttemptsForDoor\GetAttemptsForDoorUseCaseServiceProvider;
51
use Source\UseCases\DoorGroup\RemoveDoorFromGroup\RemoveDoorFromGroupUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
52
use Source\UseCases\GroupUser\RemoveUserFromGroup\RemoveUserFromGroupUseCaseServiceProvider;
53
use Source\UseCases\Attempts\GetAttemptCountForDoor\GetAttemptCountForDoorUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
54
use Source\UseCases\Entries\GetEntriesForDoorAndUser\GetEntriesForDoorAndUserUseCaseServiceProvider;
55
use Source\UseCases\Door\Authenticate\AuthenticateUseCaseServiceProvider as DoorAuthenticateUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
56
use Source\UseCases\Users\Authenticate\AuthenticateUseCaseServiceProvider as UserAuthenticateUseCaseServiceProvider;
57
58
59

class AppServiceProvider extends ServiceProvider
{
60
61
62
63
    /**
     * @var string[]
     */
    protected array $gatewayProviders = [
64
        AuthorizerServiceProvider::class,
65
        SamlRepositoryServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
66
        UsersRepositoryServiceProvider::class,
67
        DoorsRepositoryServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
68
        TokensRepositoryServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
69
        GroupsRepositoryServiceProvider::class,
70
71
        EntriesRepositoryServiceProvider::class,
        AttemptsRepositoryServiceProvider::class,
72
        DoorUserRepositoryServiceProvider::class,
73
        DoorGroupRepositoryServiceProvider::class,
74
        GroupUserRepositoryServiceProvider::class,
75
76
77
78
79
80
    ];

    /**
     * @var string[]
     */
    protected array $useCaseProviders = [
Jacob Priddy's avatar
Jacob Priddy committed
81
        // Users
Jacob Priddy's avatar
Jacob Priddy committed
82
        GetUserUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
83
        DeleteUserUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
84
        UpdateUserUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
85
        CreateUserUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
86
        GetAllUsersUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
87

Jacob Priddy's avatar
Jacob Priddy committed
88
        // Groups
Jacob Priddy's avatar
Jacob Priddy committed
89
        GetGroupUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
90
        CreateGroupUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
91
        DeleteGroupUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
92
        UpdateGroupUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
93
        GetAllGroupsUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
94

Jacob Priddy's avatar
Jacob Priddy committed
95
        // GroupUser
96
        GetUserGroupsUseCaseServiceProvider::class,
97
        GetGroupUsersUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
98
99
100
        AddUserToGroupUseCaseServiceProvider::class,
        RemoveUserFromGroupUseCaseServiceProvider::class,

101
        // DoorGroup
102
        GetDoorGroupsUseCaseServiceProvider::class,
103
        GetGroupDoorsUseCaseServiceProvider::class,
104
        AddDoorToGroupUseCaseServiceProvider::class,
105
        RemoveDoorFromGroupUseCaseServiceProvider::class,
106

107
108
109
        // Door
        AccessUseCaseServiceProvider::class,

Jacob Priddy's avatar
Jacob Priddy committed
110
        // Doors
111
        GetDoorUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
112
        CreateDoorUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
113
        DeleteDoorUseCaseServiceProvider::class,
114
        UpdateDoorUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
115
        GetAllDoorsUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
116
        AuthenticateUseCaseServiceProvider::class,
117
        DoorAuthenticateUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
118
        UserAuthenticateUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
119
        GenerateDoorTokenUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
120
121

        // Tokens
122
        GetTokenUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
123
124
        CreateTokenUseCaseServiceProvider::class,
        ExpireTokenUseCaseServiceProvider::class,
125
126
        UpdateTokenUseCaseServiceProvider::class,
        GetAllTokensUseCaseServiceProvider::class,
127
128
129

        // TokenUser
        GetUserTokensUseCaseServiceProvider::class,
130
131
132
133
134

        // Attempts
        GetAttemptsUseCaseServiceProvider::class,
        GetAttemptsForDoorUseCaseServiceProvider::class,
        GetAttemptCountForDoorUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
135
136
137
138
139
140


        // Entries
        GetEntriesForDoorUseCaseServiceProvider::class,
        GetEntriesForUserUseCaseServiceProvider::class,
        GetEntriesForDoorAndUserUseCaseServiceProvider::class,
141
142
    ];

143
144
145
146
147
148
149
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
150
        // We register gateways first, as use cases will generally use gateways
151
152
        // Not that it actually matters because they are all deferred anyway
        // and will all be registered before any need to be created.
153
154
155
156
157
158
159
        foreach ($this->gatewayProviders as $gatewayProvider) {
            $this->app->registerDeferredProvider($gatewayProvider);
        }

        foreach ($this->useCaseProviders as $useCaseProvider) {
            $this->app->registerDeferredProvider($useCaseProvider);
        }
160
161
162
163
164
165
166
167
168
169
170
171
    }

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