Merge pull request #252 from owncloud/fix_user_webdavauth

Fix user webdavauth
This commit is contained in:
Frank Karlitschek 2012-11-05 05:38:06 -08:00
commit 59381b90a0
4 changed files with 13 additions and 10 deletions

View File

@ -2,10 +2,12 @@
<info> <info>
<id>user_webdavauth</id> <id>user_webdavauth</id>
<name>WebDAV user backend</name> <name>WebDAV user backend</name>
<description>Authenticate Users by a WebDAV call</description> <description>Authenticate users by a WebDAV call. You can use any WebDAV server, ownCloud server or other webserver to authenticate. It should return http 200 for right credentials and http 401 for wrong ones.</description>
<version>1.0</version>
<licence>AGPL</licence> <licence>AGPL</licence>
<author>Frank Karlitschek</author> <author>Frank Karlitschek</author>
<require>4.9</require> <require>4.9</require>
<shipped>true</shipped> <shipped>true</shipped>
<types>
<authentication/>
</types>
</info> </info>

View File

@ -0,0 +1 @@
1.1.0.0

View File

@ -1,7 +1,7 @@
<form id="webdavauth" action="#" method="post"> <form id="webdavauth" action="#" method="post">
<fieldset class="personalblock"> <fieldset class="personalblock">
<legend><strong>WebDAV Authentication</strong></legend> <legend><strong>WebDAV Authentication</strong></legend>
<p><label for="webdav_url"><?php echo $l->t('webdav_url');?><input type="text" id="webdav_url" name="webdav_url" value="<?php echo $_['webdav_url']; ?>"></label> <p><label for="webdav_url"><?php echo $l->t('WebDAV URL: http://');?><input type="text" id="webdav_url" name="webdav_url" value="<?php echo $_['webdav_url']; ?>"></label>
<input type="submit" value="Save" /> <input type="submit" value="Save" />
</fieldset> </fieldset>
</form> </form>

View File

@ -34,7 +34,7 @@ class OC_USER_WEBDAVAUTH extends OC_User_Backend {
return false; return false;
} }
public function deleteUser() { public function deleteUser($uid) {
// Can't delete user // Can't delete user
OC_Log::write('OC_USER_WEBDAVAUTH', 'Not possible to delete users from web frontend using WebDAV user backend', 3); OC_Log::write('OC_USER_WEBDAVAUTH', 'Not possible to delete users from web frontend using WebDAV user backend', 3);
return false; return false;
@ -47,7 +47,6 @@ class OC_USER_WEBDAVAUTH extends OC_User_Backend {
} }
public function checkPassword( $uid, $password ) { public function checkPassword( $uid, $password ) {
$url= 'http://'.urlencode($uid).':'.urlencode($password).'@'.$this->webdavauth_url; $url= 'http://'.urlencode($uid).':'.urlencode($password).'@'.$this->webdavauth_url;
$headers = get_headers($url); $headers = get_headers($url);
if($headers==false) { if($headers==false) {
@ -58,9 +57,9 @@ class OC_USER_WEBDAVAUTH extends OC_User_Backend {
$returncode= substr($headers[0], 9, 3); $returncode= substr($headers[0], 9, 3);
if($returncode=='401') { if($returncode=='401') {
return false; return(false);
}else{ }else{
return true; return($uid);
} }
} }
@ -68,14 +67,15 @@ class OC_USER_WEBDAVAUTH extends OC_User_Backend {
/* /*
* we don´t know if a user exists without the password. so we have to return false all the time * we don´t know if a user exists without the password. so we have to return false all the time
*/ */
public function userExists( $uid ) { public function userExists( $uid ){
return false; return true;
} }
/* /*
* we don´t know the users so all we can do it return an empty array here * we don´t know the users so all we can do it return an empty array here
*/ */
public function getUsers() { public function getUsers($search = '', $limit = 10, $offset = 0) {
$returnArray = array(); $returnArray = array();
return $returnArray; return $returnArray;