Skip to content
Merged
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
21 changes: 9 additions & 12 deletions src/Auth/TinyAuthorize.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,9 @@
use Cake\Controller\ComponentRegistry;
use Cake\Core\Configure;
use Cake\Core\Exception\Exception;
use Cake\Database\Schema\Collection;
use Cake\Datasource\ConnectionManager;
use Cake\Network\Request;
use Cake\ORM\TableRegistry;
use Cake\Utility\Hash;
use Cake\Utility\Inflector;

if (!defined('CLASS_USERS')) {
Expand Down Expand Up @@ -65,7 +63,7 @@ class TinyAuthorize extends BaseAuthorize {
*
* @param ComponentRegistry $registry
* @param array $config
* @throws Cake\Core\Exception\Exception
* @throws \Cake\Core\Exception\Exception
*/
public function __construct(ComponentRegistry $registry, array $config = []) {
$config += (array)Configure::read('TinyAuth');
Expand All @@ -90,7 +88,7 @@ public function __construct(ComponentRegistry $registry, array $config = []) {
* - User belongsTo Roles (role_id in User array)
*
* @param array $user The user to authorize
* @param Cake\Network\Request $request The request needing authorization.
* @param \Cake\Network\Request $request The request needing authorization.
* @return bool Success
*/
public function authorize($user, Request $request) {
Expand All @@ -102,9 +100,7 @@ public function authorize($user, Request $request) {
* allows single or multi role based authorization
*
* @param array $userRoles
* @param string $plugin
* @param string $controller
* @param string $action
* @param \Cake\Network\Request $request Request instance
* @return bool Success
*/
public function validate($userRoles, Request $request) {
Expand Down Expand Up @@ -248,8 +244,9 @@ protected function _getAcl($path = null) {
/**
* Returns the acl.ini file as an array.
*
* * @param string $ini Full path to the acl.ini file
* @return array List with all available roles
* @throws Cake\Core\Exception\Exception
* @throws \Cake\Core\Exception\Exception
*/
protected function _parseAclIni($ini) {
if (!file_exists($ini)) {
Expand All @@ -270,7 +267,7 @@ protected function _parseAclIni($ini) {
/**
* Deconstructs an ACL ini section key into a named array with ACL parts
*
* @param string INI section key as found in acl.ini
* @param string $key INI section key as found in acl.ini
* @return array Hash with named keys for controller, plugin and prefix
*/
protected function _deconstructIniKey($key) {
Expand All @@ -292,7 +289,7 @@ protected function _deconstructIniKey($key) {
/**
* Constructs an ACL ini section key from a given CakeRequest
*
* @param Cake\Network\Request $request The request needing authorization.
* @param \Cake\Network\Request $request The request needing authorization.
* @return array Hash with named keys for controller, plugin and prefix
*/
protected function _constructIniKey(Request $request) {
Expand All @@ -311,7 +308,7 @@ protected function _constructIniKey(Request $request) {
* Configure first, tries database roles table next.
*
* @return array List with all available roles
* @throws Cake\Core\Exception\Exception
* @throws \Cake\Core\Exception\Exception
*/
protected function _getAvailableRoles() {
$roles = Configure::read($this->_config['rolesTable']);
Expand Down Expand Up @@ -347,7 +344,7 @@ protected function _getAvailableRoles() {
*
* @param array $user The user to get the roles for
* @return array List with all role ids belonging to the user
* @throws Cake\Core\Exception\Exception
* @throws \Cake\Core\Exception\Exception
*/
protected function _getUserRoles($user) {
// single-role
Expand Down