src/Auth/AclTrait.php
protected function _getAvailableRoles() {
		if ($this->_roles !== null) {
			return $this->_roles;
		}

		$roles = Configure::read($this->getConfig('rolesTable'));
		if (is_array($roles)) {
			if ($this->getConfig('superAdminRole')) {
				$key = $this->getConfig('superAdmin') ?: 'superadmin';
				$roles[$key] = $this->getConfig('superAdminRole');
			}
			return $roles;
		}

		$rolesTable = TableRegistry::get($this->getConfig('rolesTable'));
		$result = $rolesTable->find()->formatResults(function (ResultSetInterface $results) {
			return $results->combine($this->getConfig('aliasColumn'), 'id');
		});
		$roles = $result->toArray();

		if ($this->getConfig('superAdminRole')) {
			$key = $this->getConfig('superAdmin') ?: 'superadmin';
			$roles[$key] = $this->getConfig('superAdminRole');
		}

		if (count($roles) < 1) {
			throw new Exception('Invalid TinyAuth role setup (roles table `' . $this->getConfig('rolesTable') . '` has no roles)');
		}

		$this->_roles = $roles;

		return $roles;
	}
protected function _getAvailableRoles() {
		if ($this->_roles !== null) {
			return $this->_roles;
		}

		$roles = Configure::read($this->getConfig('rolesTable'));
		if (is_array($roles)) {
			if ($this->getConfig('superAdminRole')) {
				$key = $this->getConfig('superAdmin') ?: 'superadmin';
				$roles[$key] = $this->getConfig('superAdminRole');
			}
			return $roles;
		}

		$rolesTable = TableRegistry::get($this->getConfig('rolesTable'));
		$result = $rolesTable->find()->formatResults(function (ResultSetInterface $results) {
			return $results->combine($this->getConfig('aliasColumn'), 'id');
		});
		$roles = $result->toArray();

		if ($this->getConfig('superAdminRole')) {
			$key = $this->getConfig('superAdmin') ?: 'superadmin';
			$roles[$key] = $this->getConfig('superAdminRole');
		}

		if (count($roles) < 1) {
			throw new Exception('Invalid TinyAuth role setup (roles table `' . $this->getConfig('rolesTable') . '` has no roles)');
		}

		$this->_roles = $roles;

		return $roles;
	}
protected function _getAvailableRoles ( ) { if ( $ this -> _roles !== null ) { return $ this -> _roles ; } $ roles = Configure :: read ( $ this -> getConfig ( 'rolesTable' ) ) ; if ( is_array ( $ roles ) ) { if ( $ this -> getConfig ( 'superAdminRole' ) ) { $ key = $ this -> getConfig ( 'superAdmin' ) ? : 'superadmin' ; $ roles [ $ key ] = $ this -> getConfig ( 'superAdminRole' ) ; } return $ roles ; } $ rolesTable = TableRegistry :: get ( $ this -> getConfig ( 'rolesTable' ) ) ; $ result = $ rolesTable -> find ( ) -> formatResults ( function ( ResultSetInterface $ results ) { return $ results -> combine ( $ this -> getConfig ( 'aliasColumn' ) , 'id' ) ; } ) ; $ roles = $ result -> toArray ( ) ; if ( $ this -> getConfig ( 'superAdminRole' ) ) { $ key = $ this -> getConfig ( 'superAdmin' ) ? : 'superadmin' ; $ roles [ $ key ] = $ this -> getConfig ( 'superAdminRole' ) ; } if ( count ( $ roles ) < 1 ) { throw new Exception ( 'Invalid TinyAuth role setup (roles table `' . $ this -> getConfig ( 'rolesTable' ) . '` has no roles)' ) ; } $ this -> _roles = $ roles ; return $ roles ; }
Returns a list of all available roles.

Will look for a roles array in
Configure first, tries database roles table next.

@return array List with all available roles
@throws \Cake\Core\Exception\Exception
Returns a list of all available roles .