acl_extras icon indicating copy to clipboard operation
acl_extras copied to clipboard

Order of plugin controllers matters and is broken

Open kwentworth opened this issue 15 years ago • 6 comments

I'm upgrading my app from 1.2 to 1.3. I'm using your acl_extras and everything works great except one weird issue. I'm not sure if this is a bug in Cake or a bug with acl_extras (but I figure you'd be the guy to know).

I have plugin controllers named:

avorders_attributes_contoller.php avorders_categories_controller.php avorders_controller.php avorders_vendors_controller.php

They get input into the DB in the same order as on the file system (which is the order above). The ACL check fails for the first two controllers, but works for the 3rd and 4th. I modifed your code to sort the plugin controller names alphabetically and now ACL works as expected.

On line 190 I added: sort($controllers);

Thanks for this great plugin.

-Kevin

kwentworth avatar Sep 08 '10 20:09 kwentworth

Isn't the filesystem order, which is above, the same as alphapbetical order?

markstory avatar Sep 09 '10 01:09 markstory

How can the order they are put in the database effect the ACL check???

sitedyno avatar Sep 09 '10 02:09 sitedyno

@markstory: I'm on Windows XP and I think the underscore is basically ignored when alphabetizing the file names. In the Controllers List (where _controller.php is chopped off), now the list isn't in alpha order: AvordersAttributes, AvordersCategories, Avorders isn't in alpha order, but AvordersAttributesController, AvordersCategoriesController, AvordersController is in alpha order (which I guess is the file systems method).

@sitedyno: no clue... it doesn't make sense to me, but that's what was going on in my ACL controlled app (it was the only difference between ACOs that worked and didn't work, which was fixed after sort()ing the Controller List)

Let me know if I can help in any way.

kwentworth avatar Sep 09 '10 14:09 kwentworth

@kwentworth in 1.3 there will be no underscores in plugin or controller node aliases in linux or windows.

sitedyno avatar Sep 09 '10 18:09 sitedyno

I don't have any underscores in my node aliases. All I am trying to say is that controllers aren't always stored in alphabetical order in the file system (due to "_controller.php" being part of the file name). Why this impacts ACL check() is another issue.

kwentworth avatar Sep 09 '10 19:09 kwentworth

@kwentworth the filesystem in Windows is case-INsensitive. maybe this is part of the problem.

the0ther avatar Sep 30 '10 20:09 the0ther