From cdcde444b78570b34d90a396ac1b3a7008392a5f Mon Sep 17 00:00:00 2001 From: skeeter Date: Tue, 13 Feb 2001 04:12:53 +0000 Subject: [PATCH] disable adding from month view if insufficient rights --- calendar/inc/class.calendar_sql.inc.php | 24 +++++++++++++++++++---- calendar/inc/header.inc.php | 19 ++++++++++++++---- calendar/month.php | 26 ++++++++++++------------- 3 files changed, 48 insertions(+), 21 deletions(-) diff --git a/calendar/inc/class.calendar_sql.inc.php b/calendar/inc/class.calendar_sql.inc.php index 1b991e7763..7b89391528 100755 --- a/calendar/inc/class.calendar_sql.inc.php +++ b/calendar/inc/class.calendar_sql.inc.php @@ -104,7 +104,7 @@ $this->cal_event = CreateObject('calendar.calendar_item'); $this->stream->next_record(); // Load the calendar event data from the db into the cal_event structure - // Use http://www.php.net/manual/en/function.mcal-fetch-event.phpas the reference + // Use http://www.php.net/manual/en/function.mcal-fetch-event.php as the reference } else { @@ -794,7 +794,8 @@ function display_week($startdate,$weekly,$cellcolor,$display_name = False,$owner=0,$monthstart=0,$monthend=0) { global $phpgw; global $phpgw_info; - + global $rights; + $str = ''; $gr_events = CreateObject('calendar.calendar_item'); $lr_events = CreateObject('calendar.calendar_item'); @@ -830,8 +831,23 @@ } if (!$this->printer_friendly) { - $str = '' - . ''.lang('New Entry').''; + $str = ''; + if($rights & PHPGW_ACL_ADD) { + $str .= ''; + } + + $str .= 'set_var('new_event_link',$str); $str = ''.$date['day'].''; $p->set_var('day_number',$str); diff --git a/calendar/inc/header.inc.php b/calendar/inc/header.inc.php index 59f2b303d2..65fcf54ad7 100644 --- a/calendar/inc/header.inc.php +++ b/calendar/inc/header.inc.php @@ -16,7 +16,7 @@ if (floor($PHP_VERSION ) == 4) { global $date, $year, $month, $day, $thisyear, $thismonth, $thisday, $filter, $keywords; - global $matrixtype, $participants, $owner, $phpgw; + global $matrixtype, $participants, $owner, $phpgw, $grants, $rights; } if(!isset($phpgw_info["user"]["preferences"]["calendar"]["weekdaystarts"])) @@ -24,9 +24,21 @@ if(!isset($owner)) { $owner = 0; } + $grants = $phpgw->acl->get_grants('calendar'); + if(!isset($owner) || !$owner) { $owner = $phpgw_info['user']['account_id']; - $rights = PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE; + $rights = PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE + 16; + } else { + if($grants[$owner]) + { + $rights = $grants[$owner]; + if (!($rights & PHPGW_ACL_READ)) + { + $owner = $phpgw_info['user']['account_id']; + $rights = PHPGW_ACL_READ + PHPGW_ACL_ADD + PHPGW_ACL_EDIT + PHPGW_ACL_DELETE + 16; + } + } } if(!isset($filter) || !$filter) @@ -119,7 +131,6 @@ acl->get_grants('calendar'); if(count($grants) > 0) { ?> @@ -138,7 +149,7 @@