forked from CakeDC/users
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbootstrap.php
More file actions
36 lines (32 loc) · 1.41 KB
/
Copy pathbootstrap.php
File metadata and controls
36 lines (32 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<?php
/**
* Copyright 2010 - 2019, Cake Development Corporation (https://www.cakedc.com)
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright 2010 - 2018, Cake Development Corporation (https://www.cakedc.com)
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
use Cake\Core\Configure;
use Cake\ORM\TableRegistry;
use Cake\Routing\Router;
Configure::load('CakeDC/Users.users');
collection((array)Configure::read('Users.config'))->each(function ($file) {
Configure::load($file);
});
TableRegistry::getTableLocator()->setConfig('Users', ['className' => Configure::read('Users.table')]);
TableRegistry::getTableLocator()->setConfig('CakeDC/Users.Users', ['className' => Configure::read('Users.table')]);
if (Configure::check('Auth.authenticate') || Configure::check('Auth.authorize')) {
trigger_error("Users plugin configurations keys Auth.authenticate and Auth.authorize were removed, please check migration guide https://github.com/CakeDC/users/blob/master/Docs/Documentation/MigrationGuide.md'");
}
$oauthPath = Configure::read('OAuth.path');
if (is_array($oauthPath)) {
Router::scope('/auth', function ($routes) use ($oauthPath) {
$routes->connect(
'/:provider',
$oauthPath,
['provider' => implode('|', array_keys(Configure::read('OAuth.providers')))]
);
});
}