Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions apps/user_webdavauth/appinfo/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* @author Felix Moeller <[email protected]>
* @author Frank Karlitschek <[email protected]>
* @author j-ed <[email protected]>
* @author Lukas Reschke <[email protected]>
*
* @copyright Copyright (c) 2015, ownCloud, Inc.
* @license AGPL-3.0
Expand All @@ -20,17 +21,22 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>
*
*/
require_once OC_App::getAppPath('user_webdavauth').'/user_webdavauth.php';

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;

// 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->getUserManager(),
\OC::$SERVERROOT
);
\OC_User::useBackend($userBackend);

Util::addTranslations('user_webdavauth');
\OC_APP::registerAdmin('user_webdavauth', 'settings');
41 changes: 41 additions & 0 deletions apps/user_webdavauth/appinfo/database.xml
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>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We require PKs on all tables - please add

       <primary>true</primary>

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reminder to myself: Learn more about that mysterious database.xml - THX! ;-)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

???

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought I added a commit to this branch o.O

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Database noob here: Isn't the unique one line below exactly the same? 🙈

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unique != primary ;)

<unique>true</unique>
<field>
<name>uid</name>
</field>
</index>

</declaration>

</table>

</database>
6 changes: 3 additions & 3 deletions apps/user_webdavauth/appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
<info>
<id>user_webdavauth</id>
<name>WebDAV user backend</name>
<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>Authenticate users by a WebDAV call. You can use any WebDAV server, ownCloud server or other web server to authenticate. It should return a HTTP 2xx status code for correct credentials and a 4xx or 5xx for invalid ones.

Attention: This app is not compatible with the LDAP user and group backend. This app is not the webdav interface of ownCloud, if you don't understand what it does then do not enable it.</description>
Attention: This app is not the WebDAV interface of ownCloud, if you don't understand what it does then do not enable it.</description>
<licence>AGPL</licence>
<author>Frank Karlitschek</author>
<requiremin>4.93</requiremin>
<requiremin>7.0</requiremin>
<shipped>true</shipped>
<types>
<authentication/>
Expand Down
2 changes: 1 addition & 1 deletion apps/user_webdavauth/appinfo/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.1.0.1
1.2.0.0
6 changes: 3 additions & 3 deletions apps/user_webdavauth/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
OCP\JSON::callCheck();

if(isset($_POST['webdav_url'])) {
OC_CONFIG::setValue('user_webdavauth_url', strip_tags($_POST['webdav_url']));
\OC::$server->getConfig()->setSystemValue('user_webdavauth_url', $_POST['webdav_url']);
}
}

// fill template
$tmpl = new OC_Template( 'user_webdavauth', 'settings');
$tmpl->assign( 'webdav_url', OC_Config::getValue( "user_webdavauth_url" ));
$tmpl = new OC_Template('user_webdavauth', 'settings');
$tmpl->assign('webdav_url', \OC::$server->getConfig()->getSystemValue('user_webdavauth_url'));

return $tmpl->fetchPage();
16 changes: 12 additions & 4 deletions apps/user_webdavauth/templates/settings.php
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>
Loading