-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Store user_webdavauth users in DB + code cleanup
This commit introduces the storing of user_webdavauth users in the database which is a pre-requisite of #12620. Furthermore, I refactored the code and removed deprecated code, as a little gimmick I added unit tests for the backend.
- Loading branch information
1 parent
b33d8a3
commit 8f073a2
Showing
12 changed files
with
793 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,27 @@ | ||
<?php | ||
|
||
/** | ||
* ownCloud - user_webdavauth | ||
* | ||
* @author Frank Karlitschek | ||
* @copyright 2012 Frank Karlitschek frank@owncloud.org | ||
* | ||
* This library is free software; you can redistribute it and/or | ||
* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE | ||
* License as published by the Free Software Foundation; either | ||
* version 3 of the License, or any later version. | ||
* | ||
* This library is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU AFFERO GENERAL PUBLIC LICENSE for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public | ||
* License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
require_once OC_App::getAppPath('user_webdavauth').'/user_webdavauth.php'; | ||
* @author Frank Karlitschek | ||
* @copyright 2012 Frank Karlitschek frank@owncloud.org | ||
* @copyright 2014 Lukas Reschke lukas@owncloud.com | ||
* | ||
* This file is licensed under the Affero General Public License version 3 or | ||
* later. | ||
* See the COPYING-README file. | ||
*/ | ||
|
||
OC_APP::registerAdmin('user_webdavauth', 'settings'); | ||
namespace OCA\user_webdavauth\AppInfo; | ||
|
||
OC_User::registerBackend("WEBDAVAUTH"); | ||
OC_User::useBackend( "WEBDAVAUTH" ); | ||
use OCA\user_webdavauth\USER_WEBDAVAUTH; | ||
use OCP\Util; | ||
|
||
OCP\Util::addTranslations('user_webdavauth'); | ||
|
||
// add settings page to navigation | ||
$entry = array( | ||
'id' => "user_webdavauth_settings", | ||
'order'=>1, | ||
'href' => OC_Helper::linkTo( "user_webdavauth", "settings.php" ), | ||
'name' => 'WEBDAVAUTH' | ||
$userBackend = new USER_WEBDAVAUTH( | ||
\OC::$server->getConfig(), | ||
\OC::$server->getDb(), | ||
\OC::$server->getHTTPHelper(), | ||
\OC::$server->getLogger(), | ||
\OC::$server->getServerRoot() | ||
); | ||
\OC_User::useBackend($userBackend); | ||
|
||
Util::addTranslations('user_webdavauth'); | ||
\OC_APP::registerAdmin('user_webdavauth', 'settings'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?xml version="1.0" encoding="ISO-8859-1" ?> | ||
<database> | ||
|
||
<name>*dbname*</name> | ||
<create>true</create> | ||
<overwrite>false</overwrite> | ||
<charset>utf8</charset> | ||
|
||
<table> | ||
|
||
<name>*dbprefix*webdav_user_mapping</name> | ||
|
||
<declaration> | ||
|
||
<field> | ||
<name>uid</name> | ||
<type>text</type> | ||
<notnull>true</notnull> | ||
<length>255</length> | ||
</field> | ||
|
||
<field> | ||
<name>displayname</name> | ||
<type>text</type> | ||
<notnull>false</notnull> | ||
<length>255</length> | ||
</field> | ||
|
||
<index> | ||
<name>webdav_uid</name> | ||
<unique>true</unique> | ||
<field> | ||
<name>uid</name> | ||
</field> | ||
</index> | ||
|
||
</declaration> | ||
|
||
</table> | ||
|
||
</database> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.1.0.1 | ||
1.2.0.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,15 @@ | ||
<?php | ||
/** @var array $_ */ | ||
?> | ||
<form id="webdavauth" class="section" action="#" method="post"> | ||
<h2><?php p($l->t('WebDAV Authentication'));?></h2> | ||
<p><label for="webdav_url"><?php p($l->t('Address:').' ');?><input type="url" placeholder="https://example.com/webdav" id="webdav_url" name="webdav_url" value="<?php p($_['webdav_url']); ?>"></label> | ||
<input type="hidden" name="requesttoken" value="<?php p($_['requesttoken']) ?>" id="requesttoken"> | ||
<input type="submit" value="<?php p($l->t('Save')); ?>" /> | ||
<br /><?php p($l->t('The user credentials will be sent to this address. This plugin checks the response and will interpret the HTTP statuscodes 401 and 403 as invalid credentials, and all other responses as valid credentials.')); ?> | ||
<p> | ||
<label for="webdav_url"><?php p($l->t('Address:').' ');?> | ||
<input type="url" placeholder="https://example.com/webdav" id="webdav_url" name="webdav_url" value="<?php p($_['webdav_url']); ?>"> | ||
</label> | ||
<input type="hidden" name="requesttoken" value="<?php p($_['requesttoken']) ?>" id="requesttoken"> | ||
<input type="submit" value="<?php p($l->t('Save')); ?>" /> | ||
<br /> | ||
<?php p($l->t('The user credentials will be sent to this address. This plugin checks the response and will interpret the HTTP status codes 2xx and 403 as valid credentials, and all other responses as invalid credentials.')); ?> | ||
</p> | ||
</form> |
Oops, something went wrong.