Nice handling for no read on any categories:

- Short-cut on link query to skip search - no categories means no results
- Hide add button - with no categories, user will not be able to save
This commit is contained in:
Nathan Gray 2013-01-14 18:42:16 +00:00
parent a23f04ca2f
commit eb104a9ee5
2 changed files with 10 additions and 2 deletions

View File

@ -555,6 +555,13 @@ class resources_bo
, 'short_description' => $pattern);
}
$only_keys = 'res_id,name,short_description,bookable,useable';
// If no read access to any category, just stop
if(!$this->acl->get_cats(EGW_ACL_READ))
{
$options['total'] = 0;
return array();
}
$filter = array(
'cat_id' => array_flip((array)$this->acl->get_cats(EGW_ACL_READ)),
//'accessory_of' => '-1'

View File

@ -144,9 +144,10 @@ class resources_ui
$content['nm']['actions'] = $this->get_actions();
// check if user is permitted to add resources
if(!$this->bo->acl->get_cats(EGW_ACL_ADD))
// If they can't read any categories, they won't be able to save it
if(!$this->bo->acl->get_cats(EGW_ACL_ADD) || !$this->bo->acl->get_cats(EGW_ACL_READ))
{
$no_button['add'] = true;
$no_button['add'] = $no_button['nm']['add'] = true;
}
$no_button['back'] = true;
$GLOBALS['egw_info']['flags']['app_header'] = lang('resources');