AppServiceProvider.php 7.08 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;
48
use Source\UseCases\Attempts\GetAttemptsForDoor\GetAttemptsForDoorUseCaseServiceProvider;
49
use Source\UseCases\DoorGroup\RemoveDoorFromGroup\RemoveDoorFromGroupUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
50
use Source\UseCases\GroupUser\RemoveUserFromGroup\RemoveUserFromGroupUseCaseServiceProvider;
51
use Source\UseCases\Attempts\GetAttemptCountForDoor\GetAttemptCountForDoorUseCaseServiceProvider;
52
use Source\UseCases\Door\Authenticate\AuthenticateUseCaseServiceProvider as DoorAuthenticateUseCaseServiceProvider;
Jacob Priddy's avatar
Jacob Priddy committed
53
use Source\UseCases\Users\Authenticate\AuthenticateUseCaseServiceProvider as UserAuthenticateUseCaseServiceProvider;
54
55
56

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

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

Jacob Priddy's avatar
Jacob Priddy committed
85
        // Groups
Jacob Priddy's avatar
Jacob Priddy committed
86
        GetGroupUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
87
        CreateGroupUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
88
        DeleteGroupUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
89
        UpdateGroupUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
90
        GetAllGroupsUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
91

Jacob Priddy's avatar
Jacob Priddy committed
92
        // GroupUser
93
        GetUserGroupsUseCaseServiceProvider::class,
94
        GetGroupUsersUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
95
96
97
        AddUserToGroupUseCaseServiceProvider::class,
        RemoveUserFromGroupUseCaseServiceProvider::class,

98
        // DoorGroup
99
        GetDoorGroupsUseCaseServiceProvider::class,
100
        GetGroupDoorsUseCaseServiceProvider::class,
101
        AddDoorToGroupUseCaseServiceProvider::class,
102
        RemoveDoorFromGroupUseCaseServiceProvider::class,
103

104
105
106
        // Door
        AccessUseCaseServiceProvider::class,

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

        // Tokens
119
        GetTokenUseCaseServiceProvider::class,
Jacob Priddy's avatar
Jacob Priddy committed
120
121
        CreateTokenUseCaseServiceProvider::class,
        ExpireTokenUseCaseServiceProvider::class,
122
123
        UpdateTokenUseCaseServiceProvider::class,
        GetAllTokensUseCaseServiceProvider::class,
124
125
126

        // TokenUser
        GetUserTokensUseCaseServiceProvider::class,
127
128
129
130
131

        // Attempts
        GetAttemptsUseCaseServiceProvider::class,
        GetAttemptsForDoorUseCaseServiceProvider::class,
        GetAttemptCountForDoorUseCaseServiceProvider::class,
132
133
    ];

134
135
136
137
138
139
140
    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
141
        // We register gateways first, as use cases will generally use gateways
142
143
        // Not that it actually matters because they are all deferred anyway
        // and will all be registered before any need to be created.
144
145
146
147
148
149
150
        foreach ($this->gatewayProviders as $gatewayProvider) {
            $this->app->registerDeferredProvider($gatewayProvider);
        }

        foreach ($this->useCaseProviders as $useCaseProvider) {
            $this->app->registerDeferredProvider($useCaseProvider);
        }
151
152
153
154
155
156
157
158
159
160
161
162
    }

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