From cf5e93c9f528e237dbb0ce73817c9d0548626036 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Wed, 7 Oct 2009 09:07:50 -0700 Subject: [PATCH] Allow freebusy query to be public for freebusy URLs at least. --- htdocs/freebusy.php | 10 ++++++++-- inc/PublicSession.php | 3 ++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/htdocs/freebusy.php b/htdocs/freebusy.php index b5232c30..8e1120b2 100644 --- a/htdocs/freebusy.php +++ b/htdocs/freebusy.php @@ -2,8 +2,14 @@ require_once("../inc/always.php"); dbg_error_log( "freebusy", " User agent: %s", ((isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "Unfortunately Mulberry and Chandler don't send a 'User-agent' header with their requests :-(")) ); dbg_log_array( "headers", '_SERVER', $_SERVER, true ); -require_once("HTTPAuthSession.php"); -$session = new HTTPAuthSession(); +if ( isset($c->public_freebusy_url) && $c->public_freebusy_url ) { + require_once("PublicSession.php"); + $session = new PublicSession(); +} +else { + require_once("HTTPAuthSession.php"); + $session = new HTTPAuthSession(); +} /** * Submission parameters recommended by calconnect, plus some generous alternatives diff --git a/inc/PublicSession.php b/inc/PublicSession.php index 357e1e6b..1c700a6d 100644 --- a/inc/PublicSession.php +++ b/inc/PublicSession.php @@ -69,7 +69,8 @@ class PublicSession { * @return boolean Whether or not the user has the specified role. */ function AllowedTo ( $whatever ) { - return ( $this->logged_in && isset($this->roles[$whatever]) && $this->roles[$whatever] ); + dbg_error_log('session', 'Checking whether "Public" is allowed to "%s"', $whatever); + return ( isset($this->roles[$whatever]) && $this->roles[$whatever] ); } }