Closed davidspeijer closed 6 years ago
Hi @davidspeijer
Can you post me yuor url to AclManager please? In the image that you have provided, it appears: controller => 'Teams', action => 'index', plugin => 'AclManager'
Copy paste your bootstrap configuration please.
The URL is http://xxx.nl/timing/AclManager
Bootstrap config:
<?php
/**
* CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
* Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
*
* Licensed under The MIT License
* For full copyright and license information, please see the LICENSE.txt
* Redistributions of files must retain the above copyright notice.
*
* @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
* @link https://cakephp.org CakePHP(tm) Project
* @since 0.10.8
* @license https://opensource.org/licenses/mit-license.php MIT License
*/
/*
* Configure paths required to find CakePHP + general filepath constants
*/
require __DIR__ . '/paths.php';
/*
* Bootstrap CakePHP.
*
* Does the various bits of setup that CakePHP needs to do.
* This includes:
*
* - Registering the CakePHP autoloader.
* - Setting the default application paths.
*/
require CORE_PATH . 'config' . DS . 'bootstrap.php';
use Cake\Cache\Cache;
use Cake\Console\ConsoleErrorHandler;
use Cake\Core\App;
use Cake\Core\Configure;
use Cake\Core\Configure\Engine\PhpConfig;
use Cake\Core\Plugin;
use Cake\Database\Type;
use Cake\Datasource\ConnectionManager;
use Cake\Error\ErrorHandler;
use Cake\Http\ServerRequest;
use Cake\Log\Log;
use Cake\Mailer\Email;
use Cake\Utility\Inflector;
use Cake\Utility\Security;
/**
* Uncomment block of code below if you want to use `.env` file during development.
* You should copy `config/.env.default to `config/.env` and set/modify the
* variables as required.
*/
// if (!env('APP_NAME') && file_exists(CONFIG . '.env')) {
// $dotenv = new \josegonzalez\Dotenv\Loader([CONFIG . '.env']);
// $dotenv->parse()
// ->putenv()
// ->toEnv()
// ->toServer();
// }
/*
* Read configuration file and inject configuration into various
* CakePHP classes.
*
* By default there is only one configuration file. It is often a good
* idea to create multiple configuration files, and separate the configuration
* that changes from configuration that does not. This makes deployment simpler.
*/
try {
Configure::config('default', new PhpConfig());
Configure::load('app', 'default', false);
} catch (\Exception $e) {
exit($e->getMessage() . "\n");
}
/*
* Load an environment local configuration file.
* You can use a file like app_local.php to provide local overrides to your
* shared configuration.
*/
//Configure::load('app_local', 'default');
/*
* When debug = true the metadata cache should only last
* for a short time.
*/
if (Configure::read('debug')) {
Configure::write('Cache._cake_model_.duration', '+2 minutes');
Configure::write('Cache._cake_core_.duration', '+2 minutes');
}
/*
* Set server timezone to UTC. You can change it to another timezone of your
* choice but using UTC makes time calculations / conversions easier.
* Check http://php.net/manual/en/timezones.php for list of valid timezone strings.
*/
date_default_timezone_set('UTC');
/*
* Configure the mbstring extension to use the correct encoding.
*/
mb_internal_encoding(Configure::read('App.encoding'));
/*
* Set the default locale. This controls how dates, number and currency is
* formatted and sets the default language to use for translations.
*/
ini_set('intl.default_locale', Configure::read('App.defaultLocale'));
/*
* Register application error and exception handlers.
*/
$isCli = PHP_SAPI === 'cli';
if ($isCli) {
(new ConsoleErrorHandler(Configure::read('Error')))->register();
} else {
(new ErrorHandler(Configure::read('Error')))->register();
}
/*
* Include the CLI bootstrap overrides.
*/
if ($isCli) {
require __DIR__ . '/bootstrap_cli.php';
}
/*
* Set the full base URL.
* This URL is used as the base of all absolute links.
*
* If you define fullBaseUrl in your config file you can remove this.
*/
if (!Configure::read('App.fullBaseUrl')) {
$s = null;
if (env('HTTPS')) {
$s = 's';
}
$httpHost = env('HTTP_HOST');
if (isset($httpHost)) {
Configure::write('App.fullBaseUrl', 'http' . $s . '://' . $httpHost);
}
unset($httpHost, $s);
}
Cache::setConfig(Configure::consume('Cache'));
ConnectionManager::setConfig(Configure::consume('Datasources'));
Email::setConfigTransport(Configure::consume('EmailTransport'));
Email::setConfig(Configure::consume('Email'));
Log::setConfig(Configure::consume('Log'));
Security::setSalt(Configure::consume('Security.salt'));
/*
* The default crypto extension in 3.0 is OpenSSL.
* If you are migrating from 2.x uncomment this code to
* use a more compatible Mcrypt based implementation
*/
//Security::engine(new \Cake\Utility\Crypto\Mcrypt());
/*
* Setup detectors for mobile and tablet.
*/
ServerRequest::addDetector('mobile', function ($request) {
$detector = new \Detection\MobileDetect();
return $detector->isMobile();
});
ServerRequest::addDetector('tablet', function ($request) {
$detector = new \Detection\MobileDetect();
return $detector->isTablet();
});
/*
* Enable immutable time objects in the ORM.
*
* You can enable default locale format parsing by adding calls
* to `useLocaleParser()`. This enables the automatic conversion of
* locale specific date formats. For details see
* @link https://book.cakephp.org/3.0/en/core-libraries/internationalization-and-localization.html#parsing-localized-datetime-data
*/
Type::build('time')
->useImmutable();
Type::build('date')
->useImmutable();
Type::build('datetime')
->useImmutable();
Type::build('timestamp')
->useImmutable();
/*
* Custom Inflector rules, can be set to correctly pluralize or singularize
* table, model, controller names or whatever other string is passed to the
* inflection functions.
*/
//Inflector::rules('plural', ['/^(inflect)or$/i' => '\1ables']);
//Inflector::rules('irregular', ['red' => 'redlings']);
//Inflector::rules('uninflected', ['dontinflectme']);
//Inflector::rules('transliteration', ['/å/' => 'aa']);
/*
* Plugins need to be loaded manually, you can either load them one by one or all of them in a single call
* Uncomment one of the lines below, as you need. make sure you read the documentation on Plugin to use more
* advanced ways of loading plugins
*
* Plugin::loadAll(); // Loads all plugins at once
* Plugin::load('Migrations'); //Loads a single plugin named Migrations
*
*/
Configure::write('AclManager.aros', array('Groups', 'Users'));
Configure::write('AclManager.admin', false);
Configure::write('AclManager.hideDenied', false);
/*Configure::write('AclManager.ignoreActions', array(
'actionName', // ignore action
'Plugin.*', // Ignore the plugin
'Plugin.Controller/*', // Ignore the plugin controller
'Plugin.Controller/Action', // Ignore specific action from the plugin.
'Error/*', // Ignore the controller
'Error/Action' // Ignore specifc action from controller
));*/
Plugin::load('Acl', ['bootstrap' => true]);
Plugin::load('AclManager', ['bootstrap' => true, 'routes' => true]);
/*
* Only try to load DebugKit in development mode
* Debug Kit should not be installed on a production system
*/
if (Configure::read('debug')) {
Plugin::load('DebugKit', ['bootstrap' => true]);
}
Hi @davidspeijer
The problemm is the URL http://rideandrunbreda.nl/timing/AclManager sould be http://rideandrunbreda.nl/AclManager or http://rideandrunbreda.nl/admin/AclManager if you set true AclManager.admin option.
Read this please.
If you need the url http://rideandrunbreda.nl/timing/AclManager, you must rewrite your routes.
You must create routes like this, in your routes.php file:
Router::connect(
'timing/AclManager/AclManager',
['plugin' => 'AclManager', 'controller' => 'Acl', 'action' => 'index']
);
Router::connect(
'timing/AclManager/:action/*',
['plugin' => 'AclManager', 'controller' => 'Acl']
);
If you rewrite routes in your routes.php maybe you should set routes => false in the plugin configuration from your bootstrap.php
Try it out and tell me if it solves the problem ;)
Greetings!
I have now set in bootstrap.php
Configure::write('AclManager.admin', true);
However please note that the whole project cakephp is in /timing directory
perhaps it would be easier to use the subdomain to be clear, the same error continue when I enter http://timing.xxx.nl/admin/AclManager
At the moment also adding routes in routes.php is not helping the issue.
If the project is in the time directory, you may need to set it in .htaccess this:
RewriteBase /timing/
I don't think this is the problem.
I created a new project based on your app (https://github.com/ivanamat/cakephp3-app) and installed it to http://www.xxx.nl/testacl/AclManager what is working.
I also removed the subdomain reference, but http://www.xxx.nl/timing/admin/AclManager is still giving errors.
Have you set AclManager.admin to true in this project?
It now does; http://www.xxx.nl/testacl/admin/AclManager
However the "real" enviroment is still not working.... I created a zip with the whole project: Would this something that you could check?
Ok, no problem! ;) I'll download it and this afternoon I'll do the relevant tests. Maybe you should delete the links you have published. I have already downloaded, Modify or delete the links you have published, if you want, so that nobody can download your project.
Do you have compared the two environments?
A little bit, however I'm not sure what the base was for your project...
I'm quit sure it will be something simple. ;)
Hi! I'm having the same issue, on cake 3.5.14, it's like it can't find the proper route. I tried with admin prefix and without it. Any help is welcome! Thanks!
I haven't tried an older version of cake to see if the same issue is there but I expect that it will be something to do with a new version :).
Hi @davidspeijer and @agarassino
I have not been able to perform the tests I wanted, with the project that you passed me ( @davidspeijer ). I'm going to try this afternoon and I'll tell you something.
However, I think there may be something related to the environment.
Regards!
I was hoping you had some news for me/us? :)
Hi @davidspeijer and @agarassino
I have discovered where the "problem" is.
When you create a link, if you only specify the action in the link, by default the controller will be the controller where you are and the plugin, the plugin where you are. Then, if you specify the action and the controller, the plugin, by default, will be the plugin you are in, if you are not in any plugin the plugin is false. Then, in the menu links you must specify 'plugin' => false.
@davidspeijer in your Layout/default.ctp have
<ul class="right">
<li><?php echo $this->Html->link(__('Teams'), ['controller' => 'Teams', 'action' => 'index'); ?></li>
<li><?php echo $this->Html->link(__('Competitions'), ['controller' => 'Competitions', 'action' => 'index'); ?></li>
<li><?php echo $this->Html->link(__('Checkpoints'), ['controller' => 'Checkpoints', 'action' => 'index'); ?></li>
<li><?php echo $this->Html->link(__('Users'), ['controller' => 'Users', 'action' => 'index'); ?></li>
<li><?php echo $this->Html->link(__('Groups'), ['controller' => 'Groups', 'action' => 'index'); ?></li>
</ul>
If set 'plugin' => false it works perfectly
<ul class="right">
<li><?php echo $this->Html->link(__('Teams'), ['controller' => 'Teams', 'action' => 'index', 'plugin' => false]); ?></li>
<li><?php echo $this->Html->link(__('Competitions'), ['controller' => 'Competitions', 'action' => 'index', 'plugin' => false]); ?></li>
<li><?php echo $this->Html->link(__('Checkpoints'), ['controller' => 'Checkpoints', 'action' => 'index', 'plugin' => false]); ?></li>
<li><?php echo $this->Html->link(__('Users'), ['controller' => 'Users', 'action' => 'index', 'plugin' => false]); ?></li>
<li><?php echo $this->Html->link(__('Groups'), ['controller' => 'Groups', 'action' => 'index', 'plugin' => false]); ?></li>
</ul>
You can view it here http://test.ivanamat.es/timing/AclManager ( I will delete the link in a few days, so you can see it. )
@davidspeijer and @agarassino I close this issue.
Regards!
I have the same issue as #22 and I have no clue on how to fix it.
It's a fresh 3.5.14 project with only baked skeleton code. Using PHP 7.2.3
my routes.php file: