aboutsummaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/DAV/Sharing
diff options
context:
space:
mode:
Diffstat (limited to 'apps/dav/lib/DAV/Sharing')
-rw-r--r--apps/dav/lib/DAV/Sharing/Backend.php7
-rw-r--r--apps/dav/lib/DAV/Sharing/IShareable.php1
-rw-r--r--apps/dav/lib/DAV/Sharing/Plugin.php8
-rw-r--r--apps/dav/lib/DAV/Sharing/Xml/Invite.php10
-rw-r--r--apps/dav/lib/DAV/Sharing/Xml/ShareRequest.php6
5 files changed, 5 insertions, 27 deletions
diff --git a/apps/dav/lib/DAV/Sharing/Backend.php b/apps/dav/lib/DAV/Sharing/Backend.php
index bb04918716e..ae69e33387c 100644
--- a/apps/dav/lib/DAV/Sharing/Backend.php
+++ b/apps/dav/lib/DAV/Sharing/Backend.php
@@ -70,13 +70,13 @@ class Backend {
* @param string[] $remove
*/
public function updateShares(IShareable $shareable, array $add, array $remove) {
- foreach($add as $element) {
+ foreach ($add as $element) {
$principal = $this->principalBackend->findByUri($element['href'], '');
if ($principal !== '') {
$this->shareWith($shareable, $element);
}
}
- foreach($remove as $element) {
+ foreach ($remove as $element) {
$principal = $this->principalBackend->findByUri($element, '');
if ($principal !== '') {
$this->unshare($shareable, $element);
@@ -195,7 +195,7 @@ class Backend {
->execute();
$shares = [];
- while($row = $result->fetch()) {
+ while ($row = $result->fetch()) {
$p = $this->principalBackend->getPrincipalByPath($row['principaluri']);
$shares[]= [
'href' => "principal:${row['principaluri']}",
@@ -218,7 +218,6 @@ class Backend {
* @return array
*/
public function applyShareAcl($resourceId, $acl) {
-
$shares = $this->getShares($resourceId);
foreach ($shares as $share) {
$acl[] = [
diff --git a/apps/dav/lib/DAV/Sharing/IShareable.php b/apps/dav/lib/DAV/Sharing/IShareable.php
index 7da6549ee4f..1293721040a 100644
--- a/apps/dav/lib/DAV/Sharing/IShareable.php
+++ b/apps/dav/lib/DAV/Sharing/IShareable.php
@@ -74,5 +74,4 @@ interface IShareable extends INode {
* @return string
*/
public function getOwner();
-
}
diff --git a/apps/dav/lib/DAV/Sharing/Plugin.php b/apps/dav/lib/DAV/Sharing/Plugin.php
index f0c2b82ccbf..67eed9c9b4a 100644
--- a/apps/dav/lib/DAV/Sharing/Plugin.php
+++ b/apps/dav/lib/DAV/Sharing/Plugin.php
@@ -37,7 +37,6 @@ use Sabre\HTTP\RequestInterface;
use Sabre\HTTP\ResponseInterface;
class Plugin extends ServerPlugin {
-
const NS_OWNCLOUD = 'http://owncloud.org/ns';
const NS_NEXTCLOUD = 'http://nextcloud.com/ns';
@@ -117,13 +116,13 @@ class Plugin extends ServerPlugin {
* @return null|false
*/
function httpPost(RequestInterface $request, ResponseInterface $response) {
-
$path = $request->getPath();
// Only handling xml
$contentType = $request->getHeader('Content-Type');
- if (strpos($contentType, 'application/xml') === false && strpos($contentType, 'text/xml') === false)
+ if (strpos($contentType, 'application/xml') === false && strpos($contentType, 'text/xml') === false) {
return;
+ }
// Making sure the node exists
try {
@@ -191,14 +190,11 @@ class Plugin extends ServerPlugin {
*/
function propFind(PropFind $propFind, INode $node) {
if ($node instanceof IShareable) {
-
$propFind->handle('{' . Plugin::NS_OWNCLOUD . '}invite', function () use ($node) {
return new Invite(
$node->getShares()
);
});
-
}
}
-
}
diff --git a/apps/dav/lib/DAV/Sharing/Xml/Invite.php b/apps/dav/lib/DAV/Sharing/Xml/Invite.php
index 7852fa8431b..68aab171ab7 100644
--- a/apps/dav/lib/DAV/Sharing/Xml/Invite.php
+++ b/apps/dav/lib/DAV/Sharing/Xml/Invite.php
@@ -85,10 +85,8 @@ class Invite implements XmlSerializable {
* @param array $users
*/
function __construct(array $users, array $organizer = null) {
-
$this->users = $users;
$this->organizer = $organizer;
-
}
/**
@@ -97,9 +95,7 @@ class Invite implements XmlSerializable {
* @return array
*/
function getValue() {
-
return $this->users;
-
}
/**
@@ -122,11 +118,9 @@ class Invite implements XmlSerializable {
* @return void
*/
function xmlSerialize(Writer $writer) {
-
$cs = '{' . Plugin::NS_OWNCLOUD . '}';
if (!is_null($this->organizer)) {
-
$writer->startElement($cs . 'organizer');
$writer->writeElement('{DAV:}href', $this->organizer['href']);
@@ -140,11 +134,9 @@ class Invite implements XmlSerializable {
$writer->writeElement($cs . 'last-name', $this->organizer['lastName']);
}
$writer->endElement(); // organizer
-
}
foreach ($this->users as $user) {
-
$writer->startElement($cs . 'user');
$writer->writeElement('{DAV:}href', $user['href']);
if (isset($user['commonName']) && $user['commonName']) {
@@ -165,8 +157,6 @@ class Invite implements XmlSerializable {
}
$writer->endElement(); //user
-
}
-
}
}
diff --git a/apps/dav/lib/DAV/Sharing/Xml/ShareRequest.php b/apps/dav/lib/DAV/Sharing/Xml/ShareRequest.php
index c63bb4fe1d1..d76e65aa232 100644
--- a/apps/dav/lib/DAV/Sharing/Xml/ShareRequest.php
+++ b/apps/dav/lib/DAV/Sharing/Xml/ShareRequest.php
@@ -28,7 +28,6 @@ use Sabre\Xml\Reader;
use Sabre\Xml\XmlDeserializable;
class ShareRequest implements XmlDeserializable {
-
public $set = [];
public $remove = [];
@@ -40,14 +39,11 @@ class ShareRequest implements XmlDeserializable {
* @param array $remove
*/
function __construct(array $set, array $remove) {
-
$this->set = $set;
$this->remove = $remove;
-
}
static function xmlDeserialize(Reader $reader) {
-
$elements = $reader->parseInnerTree([
'{' . Plugin::NS_OWNCLOUD. '}set' => 'Sabre\\Xml\\Element\\KeyValue',
'{' . Plugin::NS_OWNCLOUD . '}remove' => 'Sabre\\Xml\\Element\\KeyValue',
@@ -81,7 +77,5 @@ class ShareRequest implements XmlDeserializable {
}
return new self($set, $remove);
-
}
-
}