Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .semver
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
:major: 5
:minor: 0
:patch: 2
:patch: 3
:special: ''
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ before_script:
- sh -c "if [ '$DB' = 'mysql' ]; then mysql -e 'CREATE DATABASE cakephp_test;'; fi"
- sh -c "if [ '$DB' = 'pgsql' ]; then psql -c 'CREATE DATABASE cakephp_test;' -U postgres; fi"

- sh -c "if [ '$PHPCS' = '1' ]; then composer require cakephp/cakephp-codesniffer:dev-master; fi"
- sh -c "if [ '$PHPCS' = '1' ]; then composer require 'cakephp/cakephp-codesniffer:@stable'; fi"

- sh -c "if [ '$COVERALLS' = '1' ]; then composer require --dev satooshi/php-coveralls:dev-master; fi"
- sh -c "if [ '$COVERALLS' = '1' ]; then composer require --dev 'satooshi/php-coveralls:@stable'; fi"
- sh -c "if [ '$COVERALLS' = '1' ]; then mkdir -p build/logs; fi"

script:
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Changelog
Releases for CakePHP 3
-------------

* 5.0.3
* Implemented event dispatching on social login
* Fixed bugs reported
* Don't check for allowed actions in other controllers

* 5.0.2
* Fixed bug parsing rule urls when application installed in a subdirectory

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Versions and branches
| CakePHP | CakeDC Users Plugin | Tag | Notes |
| :-------------: | :------------------------: | :--: | :---- |
| 2.x | [2.x](https://github.com/cakedc/users/tree/2.x) | 2.1.2 | Note CakePHP 2.7 is currently not supported, we are working on it now |
| 3.4+ | [master](https://github.com/cakedc/users/tree/master) | 5.0.2 | stable |
| 3.4+ | [master](https://github.com/cakedc/users/tree/master) | 5.0.3 | stable |
| 3.4+ | [develop](https://github.com/cakedc/users/tree/develop) | - | unstable |
| 3.0 | [3.0.x](https://github.com/cakedc/users/tree/3.0.x) | 3.0.0 | stable |
| 3.1 | [3.1.x](https://github.com/cakedc/users/tree/3.1.x) | 3.1.0 | stable |
Expand Down
31 changes: 15 additions & 16 deletions config/permissions.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,21 @@

return [
'Users.SimpleRbac.permissions' => [
//admin role allowed to all the things
[
'role' => '*',
'plugin' => 'CakeDC/Users',
'role' => 'admin',
'prefix' => '*',
'extension' => '*',
'plugin' => '*',
'controller' => '*',
'action' => '*',
],
//specific actions allowed for the all roles in Users plugin
[
'role' => 'user',
'role' => '*',
'plugin' => 'CakeDC/Users',
'controller' => 'Users',
'action' => ['register', 'edit', 'view'],
'action' => ['profile', 'logout'],
],
[
'role' => '*',
Expand All @@ -77,17 +81,12 @@
return false;
}
],
//all roles allowed to Pages/display
[
'role' => 'user',
'plugin' => 'CakeDC/Users',
'controller' => 'Users',
'action' => '*',
'allowed' => false,
],
[
'role' => ['user'],
'controller' => ['Pages'],
'action' => ['other', 'display'],
'allowed' => true,
'role' => '*',
//'plugin' => null,
'controller' => 'Pages',
'action' => 'display',
],
]];
]
];
8 changes: 4 additions & 4 deletions src/Auth/SocialAuthenticate.php
Original file line number Diff line number Diff line change
Expand Up @@ -433,10 +433,10 @@ public function getUser(ServerRequest $request)
protected function _getProviderName($request = null)
{
$provider = false;
if (!is_null($this->_provider)) {
$provider = SocialUtils::getProvider($this->_provider);
} elseif (!empty($request)) {
if (!empty($request->getParam('provider'))) {
$provider = ucfirst($request->getParam('provider'));
} elseif (!is_null($this->_provider)) {
$provider = SocialUtils::getProvider($this->_provider);
}

return $provider;
Expand All @@ -455,7 +455,7 @@ protected function _mapUser($provider, $data)
if (empty($provider)) {
throw new MissingProviderException(__d('CakeDC/Users', "Provider cannot be empty"));
}
$providerMapperClass = "\\CakeDC\\Users\\Auth\\Social\\Mapper\\$provider";
$providerMapperClass = $this->getConfig('providers.' . strtolower($provider) . '.options.mapper') ?: "\\CakeDC\\Users\\Auth\\Social\\Mapper\\$provider";
$providerMapper = new $providerMapperClass($data);
$user = $providerMapper();
$user['provider'] = $provider;
Expand Down