port webdav authentication to the multiuser system
This commit is contained in:
parent
2b36410e8d
commit
76eeaaea01
1 changed files with 9 additions and 6 deletions
|
@ -38,12 +38,15 @@ if(empty($_SERVER['PHP_AUTH_USER']) && empty($_SERVER['REDIRECT_REMOTE_USER']))
|
|||
|
||||
$user=$_SERVER['PHP_AUTH_USER'];
|
||||
$passwd=$_SERVER['PHP_AUTH_PW'];
|
||||
if(($user==$CONFIG_ADMINLOGIN) and ($passwd==$CONFIG_ADMINPASSWORD )){
|
||||
|
||||
$server = new HTTP_WebDAV_Server_Filesystem();
|
||||
$server->db_name = $CONFIG_DBNAME;
|
||||
$server->ServeRequest($CONFIG_DATADIRECTORY);
|
||||
|
||||
if(OC_USER::login($user,$passwd)){
|
||||
$CONFIG_DATADIRECTORY=$SERVERROOT.'/data/'.$_SESSION['username_clean'];
|
||||
if(!is_dir($CONFIG_DATADIRECTORY)){
|
||||
mkdir($CONFIG_DATADIRECTORY);
|
||||
}
|
||||
$server = new HTTP_WebDAV_Server_Filesystem();
|
||||
$server->db_name = $CONFIG_DBNAME;
|
||||
$server->ServeRequest($CONFIG_DATADIRECTORY);
|
||||
|
||||
}else{
|
||||
header('WWW-Authenticate: Basic realm="ownCloud"');
|
||||
header('HTTP/1.0 401 Unauthorized');
|
||||
|
|
Loading…
Reference in a new issue