changed the fatal "access permitted" for groups into a warning abount the not included groupmembers

This commit is contained in:
Ralf Becker 2006-03-04 09:54:31 +00:00
parent 6b3a40c69c
commit 791187bf23
5 changed files with 66 additions and 17 deletions

View File

@ -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 = '<p class="redItalic" align="center">'.lang('Access denied to the calendar of %1 !!!',implode(', ',$no_access))."</p>\n";
if ($GLOBALS['egw_info']['flags']['currentapp'] == 'home')
{
return $msg;
}
$GLOBALS['egw']->common->egw_header();
echo '<p class="redItalic" align="center">'.lang('Access denied to the calendar of %1 !!!',implode(', ',$no_access))."</p>\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 '<p class="redItalic" align="center">'.$this->html->htmlspecialchars($_GET['msg'])."</p>\n";
if ($this->group_warning) echo '<p class="redItalic" align="center">'.$this->group_warning."</p>\n";
}
/**

View File

@ -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');

View File

@ -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 = '<p class="redItalic" align="center">'.$this->group_warning."</p>\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 '<p class="redItalic" align="center">'.$this->html->htmlspecialchars($_GET['msg'])."</p>\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 '<p class="redItalic" align="center">'.$this->html->htmlspecialchars($_GET['msg'])."</p>\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 '<p class="redItalic" align="center">'.$this->html->htmlspecialchars($_GET['msg'])."</p>\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 '<p class="redItalic" align="center">'.$this->html->htmlspecialchars($_GET['msg'])."</p>\n";
$this->do_header();
$users = $this->search_params['users'];
if (!is_array($users)) $users = array($users);

View File

@ -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

View File

@ -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