Answer the question
In order to leave comments, you need to log in
ACL (access controll list) implementation. Blurred eye on the algorithm?
I am developing my own bike that needs acl. I looked at the implementation in drupal, cake, etc. nothing fits.
The bicycle works on the MVC paradigm, there is an entity and an activity (for example, the forum entity, the topic activity). It is not difficult to distribute access by user groups within the whole module:
class Acl
{
function __construct()
{
$module = $this->router->fetchCurrentModule();
$gid = $this->user->getGroupId();
$query = $db->query('SELECT perm FROM groups_permission WHERE module='.$db->escape($module).' AND gid='.$gid);
if($query->num_rows())
$perm = $query->row()->perm;
else
$perm = '';
if (strpos($perm, 'access') === FALSE) { // пока ограничение связаны только с доступом, потом можно ввести edit delete и тд.
show_message('You have no access to this module');
}
}
}
Answer the question
In order to leave comments, you need to log in
"You can enter an additional forum_permission table with user_id and perm fields, but what about other modules if they do not have such a table."
You remove the forum_ prefix in the table, and add the `entity_id` field
and add the entities table where there will be all the entities, and forums, and topics, and whatever you want, up to pressing the button.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question