Skip to content

Commit

Permalink
Prevent creation of reserved address book name
Browse files Browse the repository at this point in the history
Signed-off-by: Christoph Wurst <[email protected]>
  • Loading branch information
ChristophWurst committed Mar 9, 2020
1 parent ec245d5 commit 827c098
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions apps/dav/lib/CardDAV/UserAddressBooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@
namespace OCA\DAV\CardDAV;

use OCA\DAV\AppInfo\PluginManager;
use OCA\DAV\CardDAV\Integration\ExternalAddressBook;
use OCP\IConfig;
use OCP\IL10N;
use Sabre\CardDAV\Backend;
use Sabre\DAV\Exception\MethodNotAllowed;
use Sabre\DAV\MkCol;

class UserAddressBooks extends \Sabre\CardDAV\AddressBookHome {

Expand Down Expand Up @@ -78,6 +81,14 @@ function getChildren() {

}

public function createExtendedCollection($name, MkCol $mkCol) {
if (ExternalAddressBook::doesViolateReservedName($name)) {
throw new MethodNotAllowed('The resource you tried to create has a reserved name');
}

parent::createExtendedCollection($name, $mkCol);
}

/**
* Returns a list of ACE's for this node.
*
Expand Down

0 comments on commit 827c098

Please sign in to comment.