Log message #4222299

# At Username Text
# Jan 14th, 05:10 challgren Yes or 3.8
# Jan 14th, 05:10 matiur756 @challgren that means ...newly implement cakephp 4.0
# Jan 14th, 05:09 challgren So much has changed from 1.2 to 4.0 that its not even possible just to upgrade
# Jan 14th, 05:08 matiur756 rewrite mean ...new project implement ?
# Jan 14th, 05:08 challgren But yeah best just to rewrite
# Jan 14th, 05:04 matiur756 @challgren not fun, i am facing this problem
# Jan 14th, 05:04 challgren Ohh man that would not be a fun migration
# Jan 14th, 05:02 admad That would be a rewrite
# Jan 14th, 04:58 matiur756 how to convert cakePHP 1.2 to cakephp 4.0
# Jan 13th, 23:01 jimbo2150 Alternatively you could sort it in the Select2 element by the browser if that information is passed to the browser: https://stackoverflow.com/a/28764371/1456201
# Jan 13th, 22:54 dereuromark normal 'order' works on find(list) as well
# Jan 13th, 22:49 ndm Could be in the template, could be in the controller, could be in the model... or there could be no explicit ordering at all, and you just get the DBMS default order... you'll have to check
# Jan 13th, 22:45 Fastidius Hi all, I'm a little stuck, I have a form with a select2 dropdown but the populated list is out of order, I want to sort it by client_name not Client_id. Is the ordering handled by the Template or by the controller as I can't seem to find any way to adjust it......it's an inherited project and I'm not a cake guru so if you can point me in the right direction as to what area im meant to be adjusting
# Jan 13th, 22:10 MrEm Awesome! That did it. I had to change the last line to: `return new AuthorizationService(new ResolverCollection([$mapResolver, $ormResolver]));`
# Jan 13th, 22:03 ndm https://book.cakephp.org/authorization/2/en/policy-resolvers.html#using-resolvercollection
# Jan 13th, 22:03 ndm You probably want to use a resolve collection to add both map and orm resolver
# Jan 13th, 22:03 ndm Not if you want to use the ORM resolver too :)
# Jan 13th, 22:03 MrEm was that not the right thing?
# Jan 13th, 22:01 MrEm oh, uh - for the RequestAuthorizationMiddleware stuff that I added, I changed the resolver to the MapResolver
# Jan 13th, 21:58 MrEm Ohhh, I see what you're saying
# Jan 13th, 21:57 ndm In the plugin's source code, `vendor/cakephp/authorization/src/Policy/OrmResolver.php`
# Jan 13th, 21:55 MrEm Forgive the super noob-ness - but where would I check that at?
# Jan 13th, 21:39 ndm That looks right... not sure, might want to debug `\Authorization\Policy\OrmResolver::getEntityPolicy()` and `\Authorization\Policy\OrmResolver::findPolicy()` to check what's trying to be looked up
# Jan 13th, 21:31 MrEm $user = $this->Users->get($id);
# Jan 13th, 21:31 MrEm I'm getting the $user for deletion by:
# Jan 13th, 21:30 MrEm namespace App\Policy; ?
# Jan 13th, 21:30 ndm Wrong namespace maybe...
# Jan 13th, 21:21 MrEm I've got the UserPolicy.php living in src/Policy/
# Jan 13th, 21:19 MrEm I've created a UserPolicy#canDelete. In my UsersController#delete method I call $this->Authorization->authorize($user), but I'm getting a "Policy for App\Model\Entity\User" has not been defined
# Jan 13th, 20:46 MrEm Yep, that was it
# Jan 13th, 20:35 ndm Sounds like you've maybe added the request authorization middleware _before_ the routing middleware
# Jan 13th, 20:33 MrEm I probably have something wrong with the routing - but it seems to be routing to the right place at least. Here's the routing: https://pastebin.com/eyum1cnS
# Jan 13th, 20:32 MrEm Cool - I think I have it all set up. Now... I must have something else goofy. My route is /admin/users/add - but the controller, action, and plugin are all empty
# Jan 13th, 20:23 ndm yep
# Jan 13th, 20:21 MrEm ?
# Jan 13th, 20:21 MrEm With the "Request Authorization Middleware" Do I still need the "Authorization Middleware"
# Jan 13th, 20:15 dereuromark If you want simple prefix routing (matching role), you can even just toggle on a default config of TinyAuth.
# Jan 13th, 20:13 ndm https://book.cakephp.org/authorization/2/en/request-authorization-middleware.html
# Jan 13th, 20:13 ndm Depends on where that admin area is located... if it's easily and uniquely identifiable via routing parameters, then you might want to check the request authorization middleware. You might get away with a single policy that for example checks the prefix.
# Jan 13th, 20:03 MrEm With authorization - If I just want to restrict the admin area to those with a given role, do I still need to create Policies and issue checks in each method? Or is there a simpler/blanket way to restrict?
# Jan 13th, 20:01 ricksaccous i got you