contao/import — Issue #2159: Hook for adding permissions on group level
Author: importer
Created: 2011-11-29 19:08:25+00:00
State: open
Labels: backend, Feature

hasAccess function

Postby freeyland » Fri Jun 18, 2010 1:59 pm
Hi,

I am trying to use the following function: (check if a user, which is in group x, has access to to xls exports)
$this->User->hasAccess('xlsexport', 'boek_acc');

I've cretaed a field 'boek_acc' in the BE for tl_user and the same field for tl_user_group

When setting security settings on user level for a user (xlsexport=checked), the above is working, but when putting the user in a group and setting xlsexport=checked on group level. The above function is not working.

hasAccess only contains user level access settings and not group level settings.

I've found I had to add following code in BackendUser Class inside function setUserFromDb():
(This code is the same as for 'Calendar' Class, NEwsletter class,... line 348 )

```
//HOOK: add zsnowflake permissions
if (in_array('zsnowflake', $this->Config->getActiveModules()))
{
$depends[] = 'boekingen';
$depends[] = 'boek_acc';
}
```

Thx

--- _Originally created by freeyland on June 19th, 2010, at 08:38pm (ID 2159)_