Can someone help me who to configure cakedc\users plugin just for admin prefix in cakephp 4! I have search everywhere but dont find anything about this.
You can just auth->allow anything that is not inside admin prefix?
I have read $this->Auth has been deprecated since 4.0
I have the same problem today. Does no one has a solution?
it seems the only solution is using the idea of thomasg, just set what you need to be public. After a lot of search, i have not find any easy solution to the “problem”, and no one (don’t know why) talk about or respond about this subject. May be noob question!
I think I have found a solution. I found a hint in the Book under “Plugins” here
https://book.cakephp.org/4/en/plugins.html#plugin-routes
The last part of the paragraph describes how to do it:
“You can also load plugin routes in your application’s routes list.
Doing this provides you more control on how plugin routes are loaded and allows
you to wrap plugin routes in additional scopes or prefixes:”
And now this is my “routes.php” configuration
$routes->scope('/', function (RouteBuilder $builder) {
...
$builder->prefix('Admin', function (RouteBuilder $routes) {
$routes->connect('/', ['controller' => 'Dashboards', 'action' => 'index']);
$routes->connect('/:controller/:action/*', []);
});
$builder->scope('/admin', function (RouteBuilder $routes) {
$routes->loadPlugin('CakeDC/Users');
});
...
$builder->fallbacks();
}
That’s all. Works fine for me. Your experience?
Sorry for the late reply, Yes that work. Very thank you to share your code and help me with this