Comments (12)
Formatting got me. Those aros_acos fields create, read, update, and delete are all prefixed with an underscore in the table.
from permissionable.
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.
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.
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.
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.
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.
Ugh. I need to pay attention. Same error on both lines, actually. Copy/paste failure.
from permissionable.
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.
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.
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.
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.
fixed with recent commit changing model name
from permissionable.
Related Issues (11)
- Add UNIX-style command methods to behavior
- support inherited permissions
- Add methods to dis-/enable permissions checking/creating HOT 2
- hasOne not automatically bound when calling $Model::find('list'); HOT 5
- drops belongsTo relationships when fields=>null HOT 2
- not sure if this is Permissionable or Cakephp, but I get a sql warning on $this->paginate HOT 2
- Fail to save data because of missing bind HOT 4
- Saving HABTM HOT 1
- Web UI for setting permissions on object rows HOT 2
- $this->Model->find('list'); fails on models with permissionable attached HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from permissionable.