Giter Site home page Giter Site logo

Comments (12)

tomws avatar tomws commented on July 1, 2024

Formatting got me. Those aros_acos fields create, read, update, and delete are all prefixed with an underscore in the table.

from permissionable.

jmcneese avatar jmcneese commented on July 1, 2024

hey tom,

permissionable is not a derivative or add-on to cake's ACL mechanism. there is a specific table (included in the schema directory of the codebase) for storing the permission bits of controlled objects, which is distinct and separate from any cake ACL implementation.

from permissionable.

tomws avatar tomws commented on July 1, 2024

That's what I thought from my reading over the last couple of days, but then this error popped up during testing. I guess I have an issue with the combination of the two, then. I'll dig a little deeper and try to see what's happening.

from permissionable.

jmcneese avatar jmcneese commented on July 1, 2024

i'm fairly confused that the queries for permissions are hitting the aros_acos table at all. they should be looking for a table called "permissions"

from permissionable.

tomws avatar tomws commented on July 1, 2024

I also didn't understand why it was doing that. Just got back from lunch so I'll look into it now. For reference, here are the debug queries for the Posts with Permissionable not included but ACL still on as before.

SELECT COUNT(*) AS `count` FROM `posts` AS `Post` LEFT JOIN `users` AS `User` ON (`Post`.`user_id` = `User`.`id`) WHERE 1 = 1

SELECT `Post`.`id`, `Post`.`user_id`, `Post`.`title`, `Post`.`body`, `Post`.`created`, `Post`.`modified`, `User`.`id`, `User`.`username`, `User`.`password`, `User`.`group_id`, `User`.`created`, `User`.`modified` FROM `posts` AS `Post` LEFT JOIN `users` AS `User` ON (`Post`.`user_id` = `User`.`id`) WHERE 1 = 1 LIMIT 20

I'm guessing ACL doesn't show up since index is listed in $this->Auth->allowedActions in beforeFilter.

from permissionable.

tomws avatar tomws commented on July 1, 2024

And those queries with Permissionable included...

SELECT COUNT(*) AS `count`, `PostPermission`.* FROM `posts` AS `Post` LEFT JOIN `users` AS `User` ON (`Post`.`user_id` = `User`.`id`) INNER JOIN `aros_acos` AS `PostPermission` ON (`PostPermission`.`foreign_id` = `Post`.`id` AND `PostPermission`.`model` = 'Post' AND `PostPermission`.`foreign_id` = `Post`.`id` AND ((`PostPermission`.`perms` & 4 <> 0) OR (((`PostPermission`.`perms` & 32 <> 0) AND (`PostPermission`.`gid` IS NULL))) OR (((`PostPermission`.`perms` & 256 <> 0) AND (`PostPermission`.`uid` IS NULL))))) WHERE 1 = 1
1054: Unknown column 'PostPermission.foreign_id' in 'on clause'

SELECT `Post`.*, `PostPermission`.* FROM `posts` AS `Post` LEFT JOIN `users` AS `User` ON (`Post`.`user_id` = `User`.`id`) INNER JOIN `aros_acos` AS `PostPermission` ON (`PostPermission`.`foreign_id` = `Post`.`id` AND `PostPermission`.`model` = 'Post' AND `PostPermission`.`foreign_id` = `Post`.`id` AND ((`PostPermission`.`perms` & 4 <> 0) OR (((`PostPermission`.`perms` & 32 <> 0) AND (`PostPermission`.`gid` IS NULL))) OR (((`PostPermission`.`perms` & 256 <> 0) AND (`PostPermission`.`uid` IS NULL))))) WHERE 1 = 1 LIMIT 20

The error shows on the first query.

from permissionable.

tomws avatar tomws commented on July 1, 2024

Ugh. I need to pay attention. Same error on both lines, actually. Copy/paste failure.

from permissionable.

tomws avatar tomws commented on July 1, 2024

Well, it seems to not work with Cake's ACL enabled. If I drop ACL from app_controller, User model, and Group model, the error goes away and the query changes to looking for the permissions table. Enabling ACL in any one of those locations brings the problem back. Seems that ACL is clobbering the query with its own permissions table (aros_acos), but I haven't found out where, yet.

from permissionable.

tomws avatar tomws commented on July 1, 2024

As far as I can tell, it looks like a name crash with core ACL. See cake/libs/model/db_acl.php, class Aro (line 254) and class Permission (line 279).

from permissionable.

djstearns avatar djstearns commented on July 1, 2024

I have implemented a simple fix for this, if anyone is looking for a solution to the Acl Problem. I would submit a patch, but I am relatively new to github and don't want/have time to learn how:

+Rename to the permissions table (e.g. "permissionrecs")

+In permissionable/models/permission.php:

-Of course, rename the model class to the the same "permissionrecs" on line 14

+In permissionable/behaviors/permissionable.php:

-change line 382 from [return "{$Model->alias}Permission";] to something like: [return "{$Model->alias}Permissionrec";]

-Change line 62 from ['className' => 'Permissionable.Permission',] to: 'className' => 'Permissionable.Permissionrec',]

That's all folks!

from permissionable.

jmcneese avatar jmcneese commented on July 1, 2024

thanks dj, you can easily submit a patch by forking this repo, making the changes and committing them to your local, then pushing those commits to your fork. they will show up in my fork queue and i can integrate them in. then your commits (and name) will forever be immortalized in the source ;)

from permissionable.

jmcneese avatar jmcneese commented on July 1, 2024

fixed with recent commit changing model name

from permissionable.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.