There are certain instances in the web development process when you are being encouraged to implement access control practices that fulfill none of the criteria. That happens if, say, you are going to attach permissions to certain nodes of the same material type, or in case certain users (who have similar roles) should be granted permissions to review a particular material. To have this type of functionality implemented, one needs to make use of ACL API.
Thus we are going to install the following modules
ACL is the module which is expected to supply us with API so that the lists of permissions could be created. The module lacks user interface and is only utilized to cater to other modules’ needs.
Content Access allows for managing the permissions that are attached to certain material types.
Now we will skip through some major functions employed for ACL operation. So that a new permissions list might be created, the following function is implemented (see below):
acl_create_acl($module, $name = NULL, $number = NULL)
We observe that the above function’s taking three arguments, i.e. the module name, the newly created ACL name and number. Returned by this function is the newly created ACL’s identifier. Adding the material to the list is performed with use of the function below:
acl_node_add_acl($nid, $acl_id, $view, $update, $delete, $priority = 0)
This function operates the following way: the dedicated material is assigned with or revoked the selected permissions (view, edit, delete), while use of the previously created ACL being made. Adding a new user to the newly created list is performed with the following:
where $uid is the user identifier.