diff --git a/.semver b/.semver index 6700f56e3..75bf20832 100644 --- a/.semver +++ b/.semver @@ -1,5 +1,5 @@ --- :major: 5 :minor: 0 -:patch: 2 +:patch: 3 :special: '' diff --git a/.travis.yml b/.travis.yml index 303ead93f..40c825cdf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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: diff --git a/CHANGELOG.md b/CHANGELOG.md index 8bafddcc6..39f171a84 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/README.md b/README.md index a20f99bc6..8c397f8ac 100644 --- a/README.md +++ b/README.md @@ -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 | diff --git a/config/permissions.php b/config/permissions.php index 9db03d365..4a9efbfde 100644 --- a/config/permissions.php +++ b/config/permissions.php @@ -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' => '*', @@ -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', ], - ]]; + ] +]; diff --git a/src/Auth/SocialAuthenticate.php b/src/Auth/SocialAuthenticate.php index 0fbbe059a..4ce4fb648 100755 --- a/src/Auth/SocialAuthenticate.php +++ b/src/Auth/SocialAuthenticate.php @@ -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; @@ -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;