An access control list (ACL) is a list of rules that specifies which users or systems are granted or denied access to a particular object or system resource.
The ACL class extends the Auth class so it is possible to use all public methods found in the Auth class.
An ACL right consist of an entity
, entity_id
, right
, and auth_id
.
The entity
could be a database table named note. The entity_id
could be the primary ID
of the note table. The right
could be read
or write
, and the auth_id
is probably a
logged in user's auth_id
.
Let's test the ACL object in a controller.
We execute this controller in our index.php
file:
Run this example using:
php -S localhost:8000 -t examples/acl
You can now add the access right on http://localhost:8000/rights/add
You can remove it on http://localhost:8000/rights/remove
If the right exists then you may visit http://localhost:8000/note/read/42
But you can never visit http://localhost:8000/note/read/41 (this ID can not be set)