The hasAccess function simply checks if a field provided as parameter 2, contains the value provided in parameter 1.
You can apply this (as the News, Events) in the following way.
Note, that in both cases a field was added (extended) to BOTH tl_user and tl_user_group for gallery permissions. The statement below will check if the checkbox create has been checked for gallery permissions (galleryp).
Code:
if (!$this->User->hasAccess('create', 'galleryp'))
The second way to use it would be to validate if a user has access to a field or not. The example below checks that the alexf (access field permissions matrix) contains a parameter tl_gallery:ublished (the published field in the tl_gallery table).
Code:
if (!$this->User->hasAccess('tl_gallery::published', 'alexf'))
The hook you needed, was already there, just add your fields to the $GLOBALS['TL_PERMISSIONS'][] array...
Bookmarks