diff --git a/calendar/inc/class.calendar_ui.inc.php b/calendar/inc/class.calendar_ui.inc.php index 6a458083bc..fbd4c48360 100644 --- a/calendar/inc/class.calendar_ui.inc.php +++ b/calendar/inc/class.calendar_ui.inc.php @@ -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 diff --git a/calendar/inc/class.calendar_uiforms.inc.php b/calendar/inc/class.calendar_uiforms.inc.php index 9e5d5e8c42..0b2258933d 100644 --- a/calendar/inc/class.calendar_uiforms.inc.php +++ b/calendar/inc/class.calendar_uiforms.inc.php @@ -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 { diff --git a/calendar/inc/class.calendar_uilist.inc.php b/calendar/inc/class.calendar_uilist.inc.php index 6d24b95f44..a5cf04bf60 100644 --- a/calendar/inc/class.calendar_uilist.inc.php +++ b/calendar/inc/class.calendar_uilist.inc.php @@ -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; } diff --git a/calendar/inc/class.calendar_uiviews.inc.php b/calendar/inc/class.calendar_uiviews.inc.php index 6ab79ef6a1..c82a281c02 100644 --- a/calendar/inc/class.calendar_uiviews.inc.php +++ b/calendar/inc/class.calendar_uiviews.inc.php @@ -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;