diff --git a/calendar/inc/class.uical.inc.php b/calendar/inc/class.uical.inc.php index a4c41274c9..3120ca937e 100644 --- a/calendar/inc/class.uical.inc.php +++ b/calendar/inc/class.uical.inc.php @@ -150,25 +150,66 @@ class uical } /** - * Checks and terminates with a message if $this->owner include a user/resource we have no read-access to + * Checks and terminates (or returns for home) with a message if $this->owner include a user/resource we have no read-access to + * + * If currentapp == 'home' we return the error instead of terminating with it !!! + * + * @return boolean/string false if there's no error or string with error-message */ function check_owners_access() { - $no_access = array(); + $no_access = $no_access_group = array(); foreach(explode(',',$this->owner) as $owner) { - if (!$this->bo->check_perms(EGW_ACL_READ,0,$owner)) + if (is_numeric($owner) && $GLOBALS['egw']->accounts->get_type($owner) == 'g') + { + foreach($GLOBALS['egw']->accounts->member($owner) as $member) + { + $member = $member['account_id']; + if (!$this->bo->check_perms(EGW_ACL_READ,0,$member)) + { + $no_access_group[$member] = $this->bo->participant_name($member); + } + } + } + elseif (!$this->bo->check_perms(EGW_ACL_READ,0,$owner)) { $no_access[$owner] = $this->bo->participant_name($owner); } } if (count($no_access)) { + $msg = '
'.lang('Access denied to the calendar of %1 !!!',implode(', ',$no_access))."
\n"; + + if ($GLOBALS['egw_info']['flags']['currentapp'] == 'home') + { + return $msg; + } $GLOBALS['egw']->common->egw_header(); - echo ''.lang('Access denied to the calendar of %1 !!!',implode(', ',$no_access))."
\n"; + if ($GLOBALS['egw_info']['flags']['nonavbar']) parse_navbar(); + + echo $msg; + $GLOBALS['egw']->common->egw_footer(); $GLOBALS['egw']->common->egw_exit(); } + if (count($no_access_group)) + { + $this->group_warning = lang('Groupmember(s) %1 not included, because you have no access.',implode(', ',$no_access_group)); + } + return false; + } + + /** + * show the egw-framework plus possible messages ($_GET['msg'] and $this->group_warning from check_owner_access) + */ + function do_header() + { + $GLOBALS['egw']->common->egw_header(); + + if ($_GET['msg']) echo ''.$this->html->htmlspecialchars($_GET['msg'])."
\n"; + + if ($this->group_warning) echo ''.$this->group_warning."
\n"; } /** diff --git a/calendar/inc/class.uilist.inc.php b/calendar/inc/class.uilist.inc.php index b863856ed7..760d20cc99 100644 --- a/calendar/inc/class.uilist.inc.php +++ b/calendar/inc/class.uilist.inc.php @@ -89,7 +89,8 @@ class uilist extends uical */ function listview($content=null,$msg='',$home=false) { - if ($_GET['msg']) $msg = $_GET['msg']; + if ($_GET['msg']) $msg .= $_GET['msg']; + if ($this->group_warning) $msg .= $this->group_warning; $etpl =& CreateObject('etemplate.etemplate','calendar.list'); diff --git a/calendar/inc/class.uiviews.inc.php b/calendar/inc/class.uiviews.inc.php index 54a6dcb26b..c735caebdb 100644 --- a/calendar/inc/class.uiviews.inc.php +++ b/calendar/inc/class.uiviews.inc.php @@ -131,22 +131,31 @@ class uiviews extends uical 'multiple' => 0, 'view' => $this->bo->cal_prefs['defaultcalendar'], )); + + if (($error = $this->check_owners_access())) + { + return $error; + } + if ($this->group_warning) + { + $group_warning = ''.$this->group_warning."
\n"; + } switch($this->cal_prefs['defaultcalendar']) { case 'planner_user': case 'planner_cat': case 'planner': - return $this->planner(true); + return $group_warning.$this->planner(true); case 'month': - return $this->month(0,true); + return $group_warning.$this->month(0,true); default: case 'week': - return $this->week(0,true); + return $group_warning.$this->week(0,true); case 'day': - return $this->day(true); + return $group_warning.$this->day(true); } } @@ -205,8 +214,7 @@ class uiviews extends uical if (!$home) { - $GLOBALS['egw']->common->egw_header(); - if ($_GET['msg']) echo ''.$this->html->htmlspecialchars($_GET['msg'])."
\n"; + $this->do_header(); echo $content; } @@ -262,8 +270,7 @@ class uiviews extends uical } if (!$home) { - $GLOBALS['egw']->common->egw_header(); - if ($_GET['msg']) echo ''.$this->html->htmlspecialchars($_GET['msg'])."
\n"; + $this->do_header(); echo $content; } @@ -362,8 +369,7 @@ class uiviews extends uical } if (!$home) { - $GLOBALS['egw']->common->egw_header(); - if ($_GET['msg']) echo ''.$this->html->htmlspecialchars($_GET['msg'])."
\n"; + $this->do_header(); echo $content; } @@ -386,8 +392,7 @@ class uiviews extends uical if (!$home) { - $GLOBALS['egw']->common->egw_header(); - if ($_GET['msg']) echo ''.$this->html->htmlspecialchars($_GET['msg'])."
\n"; + $this->do_header(); $users = $this->search_params['users']; if (!is_array($users)) $users = array($users); diff --git a/calendar/setup/phpgw_de.lang b/calendar/setup/phpgw_de.lang index c649bedc03..c5a7b2cdae 100644 --- a/calendar/setup/phpgw_de.lang +++ b/calendar/setup/phpgw_de.lang @@ -126,6 +126,7 @@ global public and group public calendar de Global global public only calendar de nur Global öffentlich group planner calendar de Gruppenplaner group public only calendar de Gruppen-Öffentlich +groupmember(s) %1 not included, because you have no access. calendar de Gruppenmitglied(er) %1 nicht enthalten, da Sie keinen Zugriff haben. here is your requested alarm. calendar de Hier ist ihr bestellter Alarm. high priority calendar de Hohe Priorität holiday calendar de Feiertag diff --git a/calendar/setup/phpgw_en.lang b/calendar/setup/phpgw_en.lang index 2e59f3e8cc..f630fd3741 100644 --- a/calendar/setup/phpgw_en.lang +++ b/calendar/setup/phpgw_en.lang @@ -126,6 +126,7 @@ global public and group public calendar en global public and group public global public only calendar en global public only group planner calendar en Group planner group public only calendar en group public only +groupmember(s) %1 not included, because you have no access. calendar en Groupmember(s) %1 not included, because you have no access. here is your requested alarm. calendar en Here is your requested alarm. high priority calendar en high priority holiday calendar en Holiday