together with my other question (http://phpbuilder.com/board/showthread.php?t=10309946) I need a bit help with the query.
A colleague wrote a complete ACL for a CMS purpose, which is working fine.
Im just in doubt since he uses bitfields for permissions, and this is not my strong side.
The ACL class got 5 constants:
const READ = 1;
const WRITE = 2;
const MODIFY = 4;
const DELETE = 8;
const ALL_PERMISSIONS = 15;
The problem then exists in getting a result, if quering for lower values too.
The query, part 1:
SELECT t.`id`,t.`name`FROM `tblGallery` t
INNER JOIN `tblACOMap` m ON (t.`aco_id`=m.`aco_id`)
The query, part 2:
WHERE (m.`aro_id`=7 AND m.`permissions` & 3)
This works, because permissions is set to 3 in the database (read+write).
If I change permissions to 1 or 2 in the query instead, I would like to get a result too (if read+write is allowed, a read should be so too).
(permissions equals to the constants)
Difficult to explain it exactly, also because its not all my own code but part of a project.
The intention is a complete dynamic ACL somewhat similar to the filepermissions in Windows/unix, and it IS working (good too), Im not just that fond of bitfields in sql 😕