-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Include accept / decline links in CalDAV invitation emails
Signed-off-by: Georg Ehrke <developer@georgehrke.com>
- Loading branch information
1 parent
3ff3141
commit 4aa4e40
Showing
17 changed files
with
1,344 additions
and
9 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
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
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 |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* Database selector on install page */ | ||
form #selectPartStatForm { | ||
text-align:center; | ||
white-space: nowrap; | ||
margin: 0; | ||
} | ||
|
||
form #selectPartStatForm .info { | ||
white-space: normal; | ||
} | ||
|
||
form #selectPartStatForm input[type="radio"] { | ||
display: none; | ||
} | ||
|
||
form #selectPartStatForm input[type="radio"]:checked+label { | ||
background-color: #e8e8e8; | ||
} | ||
|
||
form #selectPartStatForm input[type="radio"]:checked ~ form fieldset#more_options { | ||
display: none; | ||
} | ||
|
||
form #selectPartStatForm label { | ||
color: #000; | ||
background-color: #f8f8f8; | ||
position: static; | ||
margin: 0 -3px 5px; | ||
cursor:pointer; | ||
border: 1px solid #ddd; | ||
display: inline-block; | ||
padding: 0; | ||
line-height: normal; | ||
vertical-align: middle; | ||
text-align: center; | ||
overflow: visible; | ||
} | ||
|
||
form #selectPartStatForm label:first-of-type { | ||
border-top-left-radius: 4px; | ||
border-bottom-left-radius: 4px; | ||
} | ||
|
||
form #selectPartStatForm label:last-of-type { | ||
border-top-right-radius: 4px; | ||
border-bottom-right-radius: 4px; | ||
} | ||
|
||
form #selectPartStatForm label span { | ||
cursor: pointer; | ||
padding: 10px 20px; | ||
display: block; | ||
line-height: normal; | ||
} | ||
form #selectPartStatForm label.ui-state-hover, | ||
form #selectPartStatForm label.ui-state-active { | ||
color:#000; | ||
background-color:#e8e8e8; | ||
} | ||
|
||
form input[type="number"] { | ||
width: 249px; | ||
background: #fff; | ||
color: #555; | ||
cursor: text; | ||
font-family: inherit; | ||
-webkit-appearance: textfield; | ||
-moz-appearance: textfield; | ||
box-sizing: content-box; | ||
border: none; | ||
font-weight: 300; | ||
} | ||
|
||
form input[type="submit"] { | ||
display: block; | ||
margin: 0 auto; | ||
padding: 11px 20px 9px | ||
} |
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,3 @@ | ||
// $(document).ready(function() { | ||
// $('#selectPartStatForm').buttonset(); | ||
// }); |
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,53 @@ | ||
<?php | ||
declare(strict_types=1); | ||
/** | ||
* @copyright 2018, Georg Ehrke <oc.list@georgehrke.com> | ||
* | ||
* @author Georg Ehrke <oc.list@georgehrke.com> | ||
* | ||
* @license GNU AGPL version 3 or any later version | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program 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 program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
namespace OCA\DAV\BackgroundJob; | ||
|
||
use OC\BackgroundJob\TimedJob; | ||
use OCP\AppFramework\Utility\ITimeFactory; | ||
use OCP\IDBConnection; | ||
|
||
class CleanupInvitationTokenJob extends TimedJob { | ||
|
||
/** @var IDBConnection */ | ||
private $db; | ||
|
||
/** @var ITimeFactory */ | ||
private $timeFactory; | ||
|
||
public function __construct(IDBConnection $db, ITimeFactory $timeFactory) { | ||
$this->db = $db; | ||
$this->timeFactory = $timeFactory; | ||
|
||
$this->setInterval(60 * 60 * 24); | ||
} | ||
|
||
public function run($argument) { | ||
$query = $this->db->getQueryBuilder(); | ||
$query->delete('calendar_invitation_tokens') | ||
->where($query->expr()->lt('expiration', | ||
$query->createNamedParameter($this->timeFactory->getTime()))) | ||
->execute(); | ||
} | ||
} |
118 changes: 118 additions & 0 deletions
118
apps/dav/lib/CalDAV/InvitationResponse/InvitationResponseServer.php
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,118 @@ | ||
<?php | ||
/** | ||
* @copyright Copyright (c) 2018, Georg Ehrke. | ||
* | ||
* @author Georg Ehrke <oc.list@georgehrke.com> | ||
* | ||
* @license AGPL-3.0 | ||
* | ||
* This code is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License, version 3, | ||
* as published by the Free Software Foundation. | ||
* | ||
* This program 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, version 3, | ||
* along with this program. If not, see <http://www.gnu.org/licenses/> | ||
* | ||
*/ | ||
namespace OCA\DAV\CalDAV\InvitationResponse; | ||
|
||
use OCA\DAV\Connector\Sabre\BlockLegacyClientPlugin; | ||
use OCA\DAV\Connector\Sabre\CachingTree; | ||
use OCA\DAV\Connector\Sabre\DavAclPlugin; | ||
use OCA\DAV\Connector\Sabre\AnonymousOptionsPlugin; | ||
use OCA\DAV\RootCollection; | ||
use OCP\SabrePluginEvent; | ||
use Sabre\DAV\Auth\Plugin; | ||
use OCA\DAV\AppInfo\PluginManager; | ||
use Sabre\VObject\ITip\Message; | ||
|
||
class InvitationResponseServer { | ||
|
||
/** @var \OCA\DAV\Connector\Sabre\Server */ | ||
public $server; | ||
|
||
/** | ||
* InvitationResponseServer constructor. | ||
*/ | ||
public function __construct() { | ||
$baseUri = \OC::$WEBROOT . '/remote.php/dav/'; | ||
$logger = \OC::$server->getLogger(); | ||
$dispatcher = \OC::$server->getEventDispatcher(); | ||
|
||
$root = new RootCollection(); | ||
$this->server = new \OCA\DAV\Connector\Sabre\Server(new CachingTree($root)); | ||
|
||
// Add maintenance plugin | ||
$this->server->addPlugin(new \OCA\DAV\Connector\Sabre\MaintenancePlugin(\OC::$server->getConfig())); | ||
|
||
// Set URL explicitly due to reverse-proxy situations | ||
$this->server->httpRequest->setUrl($baseUri); | ||
$this->server->setBaseUri($baseUri); | ||
|
||
$this->server->addPlugin(new BlockLegacyClientPlugin(\OC::$server->getConfig())); | ||
$this->server->addPlugin(new AnonymousOptionsPlugin()); | ||
$this->server->addPlugin(new class() extends Plugin { | ||
public function getCurrentPrincipal() { | ||
return 'principals/system/public'; | ||
} | ||
}); | ||
|
||
// allow setup of additional auth backends | ||
$event = new SabrePluginEvent($this->server); | ||
$dispatcher->dispatch('OCA\DAV\Connector\Sabre::authInit', $event); | ||
|
||
$this->server->addPlugin(new \OCA\DAV\Connector\Sabre\ExceptionLoggerPlugin('webdav', $logger)); | ||
$this->server->addPlugin(new \OCA\DAV\Connector\Sabre\LockPlugin()); | ||
$this->server->addPlugin(new \Sabre\DAV\Sync\Plugin()); | ||
|
||
// acl | ||
$acl = new DavAclPlugin(); | ||
$acl->principalCollectionSet = [ | ||
'principals/users', 'principals/groups' | ||
]; | ||
$acl->defaultUsernamePath = 'principals/users'; | ||
$this->server->addPlugin($acl); | ||
|
||
// calendar plugins | ||
$this->server->addPlugin(new \OCA\DAV\CalDAV\Plugin()); | ||
$this->server->addPlugin(new \Sabre\CalDAV\ICSExportPlugin()); | ||
$this->server->addPlugin(new \OCA\DAV\CalDAV\Schedule\Plugin()); | ||
$this->server->addPlugin(new \Sabre\CalDAV\Subscriptions\Plugin()); | ||
$this->server->addPlugin(new \Sabre\CalDAV\Notifications\Plugin()); | ||
//$this->server->addPlugin(new \OCA\DAV\DAV\Sharing\Plugin($authBackend, \OC::$server->getRequest())); | ||
$this->server->addPlugin(new \OCA\DAV\CalDAV\Publishing\PublishPlugin( | ||
\OC::$server->getConfig(), | ||
\OC::$server->getURLGenerator() | ||
)); | ||
|
||
// wait with registering these until auth is handled and the filesystem is setup | ||
$this->server->on('beforeMethod', function () use ($root) { | ||
// register plugins from apps | ||
$pluginManager = new PluginManager( | ||
\OC::$server, | ||
\OC::$server->getAppManager() | ||
); | ||
foreach ($pluginManager->getAppPlugins() as $appPlugin) { | ||
$this->server->addPlugin($appPlugin); | ||
} | ||
foreach ($pluginManager->getAppCollections() as $appCollection) { | ||
$root->addChild($appCollection); | ||
} | ||
}); | ||
} | ||
|
||
/** | ||
* @param Message $iTipMessage | ||
* @return void | ||
*/ | ||
public function handleITipMessage(Message $iTipMessage) { | ||
/** @var \OCA\DAV\CalDAV\Schedule\Plugin $schedulingPlugin */ | ||
$schedulingPlugin = $this->server->getPlugin('caldav-schedule'); | ||
$schedulingPlugin->scheduleLocalDelivery($iTipMessage); | ||
} | ||
} |
Oops, something went wrong.