Refactor fetching of Principal records from database.

This is a significant refactoring, replacing the old getUserBy*()
functions with a new Principal class, and replacing the old
CalDAVPrincipal class with a new DAVPrincipal class which extends
the Principal class.

At this point all regression tests pass (again) but there could
well be issues for people who use alternative authenticators
such as LDAP, although I have endeavoured to resolve those
potential issues.

Signed-off-by: Andrew McMillan <andrew@morphoss.com>
This commit is contained in:
Andrew McMillan committed 2011-01-03 10:16:43 +13:00
1 parent b35d71e69c
commit 20ee255898
19 files changed
+1214 -946

No files matched your search

+5 -4
View File
@@ -132,14 +132,15 @@ class Tools {
if ( $ics != '' ) {
include_once('check_UTF8.php');
if ( check_string($ics) ) {
$path = "/".substr($file,0,-4).$path_ics;
$username = substr($file,0,-4);
$path = "/".$username.$path_ics;
dbg_error_log( "importFromDirectory", "importing to $path");
$c->readonly_webdav_collections = false; // Override this setting so we can create collections/events on import.
require_once("caldav-PUT-functions.php");
if ( $user = getUserByName(substr($file,0,-4),'importFromDirectory',__LINE__,__FILE__)) {
$user_no = $user->user_no;
if ( $principal = new Principal('username',$username) ) {
$user_no = $principal->user_no();
}
if(controlRequestContainer(substr($file,0,-4),$user_no, $path,false) === -1)
if ( controlRequestContainer($username, $user_no, $path, false) === -1)
continue;
import_collection($ics,$user_no,$path,1);
$c->messages[] = sprintf(translate('all events of user %s were deleted and replaced by those from file %s'),substr($file,0,-4),$dir.'/'.$file);