mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 16:44:20 +01:00
calendar GUI classes now use centralized method in categories class to check for category permissions
This commit is contained in:
parent
30fd54c4ac
commit
5ce294aa5c
@ -164,35 +164,6 @@ class calendar_ui
|
||||
// calendar does not work with hidden sidebox atm.
|
||||
unset($GLOBALS['egw_info']['user']['preferences']['common']['auto_hide_sidebox']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks category permissions
|
||||
* Takes a commaseparated list of category ids
|
||||
* and truncates it by the ones the user does not have the requested permission on
|
||||
*
|
||||
* @param int $needed necessary ACL right: EGW_ACL_{READ|EDIT|DELETE}
|
||||
* @param string $categories commaseparated list of category ids
|
||||
* @return string truncated commaseparated list of category ids
|
||||
*/
|
||||
function check_category_perms($needed, $categories)
|
||||
{
|
||||
if (empty($categories)) return $categories;
|
||||
|
||||
$cat_arr = explode(',',$categories);
|
||||
if (!empty($cat_arr) && is_array($cat_arr) && count($cat_arr) > 0)
|
||||
{
|
||||
foreach($cat_arr as $id=>$cat_id)
|
||||
{
|
||||
if (!$this->categories->check_perms($needed, $cat_id))
|
||||
{
|
||||
unset($cat_arr[$id]);
|
||||
}
|
||||
}
|
||||
$categories = implode(',',$cat_arr);
|
||||
}
|
||||
|
||||
return $categories;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks and terminates (or returns for home) with a message if $this->owner include a user/resource we have no read-access to
|
||||
|
@ -1047,8 +1047,11 @@ class calendar_uiforms extends calendar_ui
|
||||
}
|
||||
$content['participants']['no_add'] = true;
|
||||
|
||||
// respect category ACLs
|
||||
$content['category'] = $this->check_category_perms(EGW_ACL_READ, $event['category']);
|
||||
// respect category permissions
|
||||
if(!empty($event['category']))
|
||||
{
|
||||
$content['category'] = $this->categories->check_list(EGW_ACL_READ, $event['category']);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -312,7 +312,12 @@ class calendar_uilist extends calendar_ui
|
||||
}
|
||||
if (empty($event['description'])) $event['description'] = ' '; // no description screws the titles horz. alignment
|
||||
if (empty($event['location'])) $event['location'] = ' '; // no location screws the owner horz. alignment
|
||||
$event['category'] = $this->check_category_perms(EGW_ACL_READ, $event['category']);
|
||||
|
||||
// respect category permissions
|
||||
if(!empty($event['category']))
|
||||
{
|
||||
$event['category'] = $this->categories->check_list(EGW_ACL_READ, $event['category']);
|
||||
}
|
||||
|
||||
$rows[] = $event;
|
||||
}
|
||||
|
@ -1160,7 +1160,7 @@ class calendar_uiviews extends calendar_ui
|
||||
$is_private = !$this->bo->check_perms(EGW_ACL_READ,$event);
|
||||
|
||||
$icons = !$is_private ? $this->event_icons($event) : array(html::image('calendar','private',lang('private')));
|
||||
$cats = $this->bo->categories($this->check_category_perms(EGW_ACL_READ, $event['category']),$color);
|
||||
$cats = $this->bo->categories($this->categories->check_list(EGW_ACL_READ, $event['category']),$color);
|
||||
// these values control varius aspects of the geometry of the eventWidget
|
||||
$small_trigger_width = 120 + 20*count($icons);
|
||||
$corner_radius=$width > $small_trigger_width ? 10 : 5;
|
||||
|
Loading…
Reference in New Issue
Block a user