Add visibility to all methods and position of static keyword
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
parent
a7c8d26d31
commit
1584c9ae9c
|
@ -73,7 +73,7 @@ class AddressBook extends ExternalAddressBook implements IACL {
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
function createFile($name, $data = null) {
|
public function createFile($name, $data = null) {
|
||||||
throw new Exception("This addressbook is immutable");
|
throw new Exception("This addressbook is immutable");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,84 +52,84 @@ class Card implements ICard, IACL {
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
function getOwner(): ?string {
|
public function getOwner(): ?string {
|
||||||
$this->principal;
|
$this->principal;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
function getACL(): array {
|
public function getACL(): array {
|
||||||
return $this->acls;
|
return $this->acls;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
function setAcls(array $acls): void {
|
public function setAcls(array $acls): void {
|
||||||
throw new NotImplemented();
|
throw new NotImplemented();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
function put($data): ?string {
|
public function put($data): ?string {
|
||||||
throw new NotImplemented();
|
throw new NotImplemented();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
function get() {
|
public function get() {
|
||||||
return $this->contact->getCard();
|
return $this->contact->getCard();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
function getContentType(): ?string {
|
public function getContentType(): ?string {
|
||||||
return 'text/vcard; charset=utf-8';
|
return 'text/vcard; charset=utf-8';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
function getETag(): ?string {
|
public function getETag(): ?string {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
function getSize(): int {
|
public function getSize(): int {
|
||||||
throw new NotImplemented();
|
throw new NotImplemented();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
function delete(): void {
|
public function delete(): void {
|
||||||
throw new NotImplemented();
|
throw new NotImplemented();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
function getName(): string {
|
public function getName(): string {
|
||||||
return (string) $this->contact->getId();
|
return (string) $this->contact->getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
function setName($name): void {
|
public function setName($name): void {
|
||||||
throw new NotImplemented();
|
throw new NotImplemented();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
function getLastModified(): ?int {
|
public function getLastModified(): ?int {
|
||||||
return $this->contact->getLastContact();
|
return $this->contact->getLastContact();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -253,7 +253,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
* @param string $principalUri
|
* @param string $principalUri
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getCalendarsForUser($principalUri) {
|
public function getCalendarsForUser($principalUri) {
|
||||||
$principalUriOriginal = $principalUri;
|
$principalUriOriginal = $principalUri;
|
||||||
$principalUri = $this->convertPrincipal($principalUri, true);
|
$principalUri = $this->convertPrincipal($principalUri, true);
|
||||||
$fields = array_values($this->propertyMap);
|
$fields = array_values($this->propertyMap);
|
||||||
|
@ -722,7 +722,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
* @return int
|
* @return int
|
||||||
* @suppress SqlInjectionChecker
|
* @suppress SqlInjectionChecker
|
||||||
*/
|
*/
|
||||||
function createCalendar($principalUri, $calendarUri, array $properties) {
|
public function createCalendar($principalUri, $calendarUri, array $properties) {
|
||||||
$values = [
|
$values = [
|
||||||
'principaluri' => $this->convertPrincipal($principalUri, true),
|
'principaluri' => $this->convertPrincipal($principalUri, true),
|
||||||
'uri' => $calendarUri,
|
'uri' => $calendarUri,
|
||||||
|
@ -790,7 +790,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
* @param PropPatch $propPatch
|
* @param PropPatch $propPatch
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function updateCalendar($calendarId, PropPatch $propPatch) {
|
public function updateCalendar($calendarId, PropPatch $propPatch) {
|
||||||
$supportedProperties = array_keys($this->propertyMap);
|
$supportedProperties = array_keys($this->propertyMap);
|
||||||
$supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp';
|
$supportedProperties[] = '{' . Plugin::NS_CALDAV . '}schedule-calendar-transp';
|
||||||
|
|
||||||
|
@ -840,7 +840,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
* @param mixed $calendarId
|
* @param mixed $calendarId
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function deleteCalendar($calendarId) {
|
public function deleteCalendar($calendarId) {
|
||||||
$this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendar', new GenericEvent(
|
$this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendar', new GenericEvent(
|
||||||
'\OCA\DAV\CalDAV\CalDavBackend::deleteCalendar',
|
'\OCA\DAV\CalDAV\CalDavBackend::deleteCalendar',
|
||||||
[
|
[
|
||||||
|
@ -873,7 +873,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
* @param string $principaluri
|
* @param string $principaluri
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function deleteAllSharesByUser($principaluri) {
|
public function deleteAllSharesByUser($principaluri) {
|
||||||
$this->calendarSharingBackend->deleteAllSharesByUser($principaluri);
|
$this->calendarSharingBackend->deleteAllSharesByUser($principaluri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1048,7 +1048,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
* @param int $calendarType
|
* @param int $calendarType
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function createCalendarObject($calendarId, $objectUri, $calendarData, $calendarType=self::CALENDAR_TYPE_CALENDAR) {
|
public function createCalendarObject($calendarId, $objectUri, $calendarData, $calendarType=self::CALENDAR_TYPE_CALENDAR) {
|
||||||
$extraData = $this->getDenormalizedData($calendarData);
|
$extraData = $this->getDenormalizedData($calendarData);
|
||||||
|
|
||||||
$q = $this->db->getQueryBuilder();
|
$q = $this->db->getQueryBuilder();
|
||||||
|
@ -1131,7 +1131,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
* @param int $calendarType
|
* @param int $calendarType
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function updateCalendarObject($calendarId, $objectUri, $calendarData, $calendarType=self::CALENDAR_TYPE_CALENDAR) {
|
public function updateCalendarObject($calendarId, $objectUri, $calendarData, $calendarType=self::CALENDAR_TYPE_CALENDAR) {
|
||||||
$extraData = $this->getDenormalizedData($calendarData);
|
$extraData = $this->getDenormalizedData($calendarData);
|
||||||
$query = $this->db->getQueryBuilder();
|
$query = $this->db->getQueryBuilder();
|
||||||
$query->update('calendarobjects')
|
$query->update('calendarobjects')
|
||||||
|
@ -1207,7 +1207,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
* @param int $calendarType
|
* @param int $calendarType
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function deleteCalendarObject($calendarId, $objectUri, $calendarType=self::CALENDAR_TYPE_CALENDAR) {
|
public function deleteCalendarObject($calendarId, $objectUri, $calendarType=self::CALENDAR_TYPE_CALENDAR) {
|
||||||
$data = $this->getCalendarObject($calendarId, $objectUri, $calendarType);
|
$data = $this->getCalendarObject($calendarId, $objectUri, $calendarType);
|
||||||
if (is_array($data)) {
|
if (is_array($data)) {
|
||||||
if ($calendarType === self::CALENDAR_TYPE_CALENDAR) {
|
if ($calendarType === self::CALENDAR_TYPE_CALENDAR) {
|
||||||
|
@ -1688,7 +1688,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
* @param string $uid
|
* @param string $uid
|
||||||
* @return string|null
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
function getCalendarObjectByUID($principalUri, $uid) {
|
public function getCalendarObjectByUID($principalUri, $uid) {
|
||||||
$query = $this->db->getQueryBuilder();
|
$query = $this->db->getQueryBuilder();
|
||||||
$query->selectAlias('c.uri', 'calendaruri')->selectAlias('co.uri', 'objecturi')
|
$query->selectAlias('c.uri', 'calendaruri')->selectAlias('co.uri', 'objecturi')
|
||||||
->from('calendarobjects', 'co')
|
->from('calendarobjects', 'co')
|
||||||
|
@ -1763,7 +1763,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
* @param int $calendarType
|
* @param int $calendarType
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null, $calendarType=self::CALENDAR_TYPE_CALENDAR) {
|
public function getChangesForCalendar($calendarId, $syncToken, $syncLevel, $limit = null, $calendarType=self::CALENDAR_TYPE_CALENDAR) {
|
||||||
// Current synctoken
|
// Current synctoken
|
||||||
$stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*calendars` WHERE `id` = ?');
|
$stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*calendars` WHERE `id` = ?');
|
||||||
$stmt->execute([ $calendarId ]);
|
$stmt->execute([ $calendarId ]);
|
||||||
|
@ -1854,7 +1854,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
* @param string $principalUri
|
* @param string $principalUri
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getSubscriptionsForUser($principalUri) {
|
public function getSubscriptionsForUser($principalUri) {
|
||||||
$fields = array_values($this->subscriptionPropertyMap);
|
$fields = array_values($this->subscriptionPropertyMap);
|
||||||
$fields[] = 'id';
|
$fields[] = 'id';
|
||||||
$fields[] = 'uri';
|
$fields[] = 'uri';
|
||||||
|
@ -1906,7 +1906,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
* @param array $properties
|
* @param array $properties
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
function createSubscription($principalUri, $uri, array $properties) {
|
public function createSubscription($principalUri, $uri, array $properties) {
|
||||||
if (!isset($properties['{http://calendarserver.org/ns/}source'])) {
|
if (!isset($properties['{http://calendarserver.org/ns/}source'])) {
|
||||||
throw new Forbidden('The {http://calendarserver.org/ns/}source property is required when creating subscriptions');
|
throw new Forbidden('The {http://calendarserver.org/ns/}source property is required when creating subscriptions');
|
||||||
}
|
}
|
||||||
|
@ -1969,7 +1969,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
* @param PropPatch $propPatch
|
* @param PropPatch $propPatch
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function updateSubscription($subscriptionId, PropPatch $propPatch) {
|
public function updateSubscription($subscriptionId, PropPatch $propPatch) {
|
||||||
$supportedProperties = array_keys($this->subscriptionPropertyMap);
|
$supportedProperties = array_keys($this->subscriptionPropertyMap);
|
||||||
$supportedProperties[] = '{http://calendarserver.org/ns/}source';
|
$supportedProperties[] = '{http://calendarserver.org/ns/}source';
|
||||||
|
|
||||||
|
@ -2015,7 +2015,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
* @param mixed $subscriptionId
|
* @param mixed $subscriptionId
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function deleteSubscription($subscriptionId) {
|
public function deleteSubscription($subscriptionId) {
|
||||||
$this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteSubscription', new GenericEvent(
|
$this->dispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteSubscription', new GenericEvent(
|
||||||
'\OCA\DAV\CalDAV\CalDavBackend::deleteSubscription',
|
'\OCA\DAV\CalDAV\CalDavBackend::deleteSubscription',
|
||||||
[
|
[
|
||||||
|
@ -2061,7 +2061,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
* @param string $objectUri
|
* @param string $objectUri
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getSchedulingObject($principalUri, $objectUri) {
|
public function getSchedulingObject($principalUri, $objectUri) {
|
||||||
$query = $this->db->getQueryBuilder();
|
$query = $this->db->getQueryBuilder();
|
||||||
$stmt = $query->select(['uri', 'calendardata', 'lastmodified', 'etag', 'size'])
|
$stmt = $query->select(['uri', 'calendardata', 'lastmodified', 'etag', 'size'])
|
||||||
->from('schedulingobjects')
|
->from('schedulingobjects')
|
||||||
|
@ -2095,7 +2095,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
* @param string $principalUri
|
* @param string $principalUri
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getSchedulingObjects($principalUri) {
|
public function getSchedulingObjects($principalUri) {
|
||||||
$query = $this->db->getQueryBuilder();
|
$query = $this->db->getQueryBuilder();
|
||||||
$stmt = $query->select(['uri', 'calendardata', 'lastmodified', 'etag', 'size'])
|
$stmt = $query->select(['uri', 'calendardata', 'lastmodified', 'etag', 'size'])
|
||||||
->from('schedulingobjects')
|
->from('schedulingobjects')
|
||||||
|
@ -2123,7 +2123,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
* @param string $objectUri
|
* @param string $objectUri
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function deleteSchedulingObject($principalUri, $objectUri) {
|
public function deleteSchedulingObject($principalUri, $objectUri) {
|
||||||
$query = $this->db->getQueryBuilder();
|
$query = $this->db->getQueryBuilder();
|
||||||
$query->delete('schedulingobjects')
|
$query->delete('schedulingobjects')
|
||||||
->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
|
->where($query->expr()->eq('principaluri', $query->createNamedParameter($principalUri)))
|
||||||
|
@ -2139,7 +2139,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
|
||||||
* @param string $objectData
|
* @param string $objectData
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function createSchedulingObject($principalUri, $objectUri, $objectData) {
|
public function createSchedulingObject($principalUri, $objectUri, $objectData) {
|
||||||
$query = $this->db->getQueryBuilder();
|
$query = $this->db->getQueryBuilder();
|
||||||
$query->insert('schedulingobjects')
|
$query->insert('schedulingobjects')
|
||||||
->values([
|
->values([
|
||||||
|
|
|
@ -73,7 +73,7 @@ class CalendarHome extends \Sabre\CalDAV\CalendarHome {
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
function createExtendedCollection($name, MkCol $mkCol) {
|
public function createExtendedCollection($name, MkCol $mkCol) {
|
||||||
$reservedNames = [BirthdayService::BIRTHDAY_CALENDAR_URI];
|
$reservedNames = [BirthdayService::BIRTHDAY_CALENDAR_URI];
|
||||||
|
|
||||||
if (\in_array($name, $reservedNames, true) || ExternalCalendar::doesViolateReservedName($name)) {
|
if (\in_array($name, $reservedNames, true) || ExternalCalendar::doesViolateReservedName($name)) {
|
||||||
|
@ -86,7 +86,7 @@ class CalendarHome extends \Sabre\CalDAV\CalendarHome {
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
function getChildren() {
|
public function getChildren() {
|
||||||
$calendars = $this->caldavBackend->getCalendarsForUser($this->principalInfo['uri']);
|
$calendars = $this->caldavBackend->getCalendarsForUser($this->principalInfo['uri']);
|
||||||
$objects = [];
|
$objects = [];
|
||||||
foreach ($calendars as $calendar) {
|
foreach ($calendars as $calendar) {
|
||||||
|
@ -128,7 +128,7 @@ class CalendarHome extends \Sabre\CalDAV\CalendarHome {
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
function getChild($name) {
|
public function getChild($name) {
|
||||||
// Special nodes
|
// Special nodes
|
||||||
if ($name === 'inbox' && $this->caldavBackend instanceof SchedulingSupport) {
|
if ($name === 'inbox' && $this->caldavBackend instanceof SchedulingSupport) {
|
||||||
return new Inbox($this->caldavBackend, $this->principalInfo['uri']);
|
return new Inbox($this->caldavBackend, $this->principalInfo['uri']);
|
||||||
|
@ -182,7 +182,7 @@ class CalendarHome extends \Sabre\CalDAV\CalendarHome {
|
||||||
* @param integer|null $limit
|
* @param integer|null $limit
|
||||||
* @param integer|null $offset
|
* @param integer|null $offset
|
||||||
*/
|
*/
|
||||||
function calendarSearch(array $filters, $limit=null, $offset=null) {
|
public function calendarSearch(array $filters, $limit=null, $offset=null) {
|
||||||
$principalUri = $this->principalInfo['uri'];
|
$principalUri = $this->principalInfo['uri'];
|
||||||
return $this->caldavBackend->calendarSearch($principalUri, $filters, $limit, $offset);
|
return $this->caldavBackend->calendarSearch($principalUri, $filters, $limit, $offset);
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ class CalendarObject extends \Sabre\CalDAV\CalendarObject {
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
function get() {
|
public function get() {
|
||||||
$data = parent::get();
|
$data = parent::get();
|
||||||
|
|
||||||
if (!$this->isShared()) {
|
if (!$this->isShared()) {
|
||||||
|
|
|
@ -26,11 +26,11 @@
|
||||||
namespace OCA\DAV\CalDAV;
|
namespace OCA\DAV\CalDAV;
|
||||||
|
|
||||||
class CalendarRoot extends \Sabre\CalDAV\CalendarRoot {
|
class CalendarRoot extends \Sabre\CalDAV\CalendarRoot {
|
||||||
function getChildForPrincipal(array $principal) {
|
public function getChildForPrincipal(array $principal) {
|
||||||
return new CalendarHome($this->caldavBackend, $principal);
|
return new CalendarHome($this->caldavBackend, $principal);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getName() {
|
public function getName() {
|
||||||
if ($this->principalPrefix === 'principals/calendar-resources' ||
|
if ($this->principalPrefix === 'principals/calendar-resources' ||
|
||||||
$this->principalPrefix === 'principals/calendar-rooms') {
|
$this->principalPrefix === 'principals/calendar-rooms') {
|
||||||
$parts = explode('/', $this->principalPrefix);
|
$parts = explode('/', $this->principalPrefix);
|
||||||
|
|
|
@ -63,7 +63,7 @@ class Outbox extends \Sabre\CalDAV\Schedule\Outbox {
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getACL() {
|
public function getACL() {
|
||||||
// getACL is called so frequently that we cache the config result
|
// getACL is called so frequently that we cache the config result
|
||||||
if ($this->disableFreeBusy === null) {
|
if ($this->disableFreeBusy === null) {
|
||||||
$this->disableFreeBusy = ($this->config->getAppValue('dav', 'disableFreeBusy', 'no') === 'yes');
|
$this->disableFreeBusy = ($this->config->getAppValue('dav', 'disableFreeBusy', 'no') === 'yes');
|
||||||
|
|
|
@ -37,7 +37,7 @@ class Plugin extends \Sabre\CalDAV\Plugin {
|
||||||
* @param string $principalUrl
|
* @param string $principalUrl
|
||||||
* @return string|null
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
function getCalendarHomeForPrincipal($principalUrl) {
|
public function getCalendarHomeForPrincipal($principalUrl) {
|
||||||
if (strrpos($principalUrl, 'principals/users', -strlen($principalUrl)) !== false) {
|
if (strrpos($principalUrl, 'principals/users', -strlen($principalUrl)) !== false) {
|
||||||
list(, $principalId) = \Sabre\Uri\split($principalUrl);
|
list(, $principalId) = \Sabre\Uri\split($principalUrl);
|
||||||
return self::CALENDAR_ROOT . '/' . $principalId;
|
return self::CALENDAR_ROOT . '/' . $principalId;
|
||||||
|
|
|
@ -36,7 +36,7 @@ class Collection extends \Sabre\CalDAV\Principal\Collection {
|
||||||
* @param array $principalInfo
|
* @param array $principalInfo
|
||||||
* @return User
|
* @return User
|
||||||
*/
|
*/
|
||||||
function getChildForPrincipal(array $principalInfo) {
|
public function getChildForPrincipal(array $principalInfo) {
|
||||||
return new User($this->principalBackend, $principalInfo);
|
return new User($this->principalBackend, $principalInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ class User extends \Sabre\CalDAV\Principal\User {
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getACL() {
|
public function getACL() {
|
||||||
$acl = parent::getACL();
|
$acl = parent::getACL();
|
||||||
$acl[] = [
|
$acl[] = [
|
||||||
'privilege' => '{DAV:}read',
|
'privilege' => '{DAV:}read',
|
||||||
|
|
|
@ -48,7 +48,7 @@ class PublicCalendarRoot extends Collection {
|
||||||
* @param IL10N $l10n
|
* @param IL10N $l10n
|
||||||
* @param IConfig $config
|
* @param IConfig $config
|
||||||
*/
|
*/
|
||||||
function __construct(CalDavBackend $caldavBackend, IL10N $l10n,
|
public function __construct(CalDavBackend $caldavBackend, IL10N $l10n,
|
||||||
IConfig $config) {
|
IConfig $config) {
|
||||||
$this->caldavBackend = $caldavBackend;
|
$this->caldavBackend = $caldavBackend;
|
||||||
$this->l10n = $l10n;
|
$this->l10n = $l10n;
|
||||||
|
@ -58,14 +58,14 @@ class PublicCalendarRoot extends Collection {
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
function getName() {
|
public function getName() {
|
||||||
return 'public-calendars';
|
return 'public-calendars';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
function getChild($name) {
|
public function getChild($name) {
|
||||||
$calendar = $this->caldavBackend->getPublicCalendar($name);
|
$calendar = $this->caldavBackend->getPublicCalendar($name);
|
||||||
return new PublicCalendar($this->caldavBackend, $calendar, $this->l10n, $this->config);
|
return new PublicCalendar($this->caldavBackend, $calendar, $this->l10n, $this->config);
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ class PublicCalendarRoot extends Collection {
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
function getChildren() {
|
public function getChildren() {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ class Publisher implements XmlSerializable {
|
||||||
* @param string $publishUrl
|
* @param string $publishUrl
|
||||||
* @param boolean $isPublished
|
* @param boolean $isPublished
|
||||||
*/
|
*/
|
||||||
function __construct($publishUrl, $isPublished) {
|
public function __construct($publishUrl, $isPublished) {
|
||||||
$this->publishUrl = $publishUrl;
|
$this->publishUrl = $publishUrl;
|
||||||
$this->isPublished = $isPublished;
|
$this->isPublished = $isPublished;
|
||||||
}
|
}
|
||||||
|
@ -51,7 +51,7 @@ class Publisher implements XmlSerializable {
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function getValue() {
|
public function getValue() {
|
||||||
return $this->publishUrl;
|
return $this->publishUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ class Publisher implements XmlSerializable {
|
||||||
* @param Writer $writer
|
* @param Writer $writer
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function xmlSerialize(Writer $writer) {
|
public function xmlSerialize(Writer $writer) {
|
||||||
if (!$this->isPublished) {
|
if (!$this->isPublished) {
|
||||||
// for pre-publish-url
|
// for pre-publish-url
|
||||||
$writer->write($this->publishUrl);
|
$writer->write($this->publishUrl);
|
||||||
|
|
|
@ -229,7 +229,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface {
|
||||||
* @param PropPatch $propPatch
|
* @param PropPatch $propPatch
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function updatePrincipal($path, PropPatch $propPatch) {
|
public function updatePrincipal($path, PropPatch $propPatch) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -239,7 +239,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface {
|
||||||
* @param string $test
|
* @param string $test
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function searchPrincipals($prefixPath, array $searchProperties, $test = 'allof') {
|
public function searchPrincipals($prefixPath, array $searchProperties, $test = 'allof') {
|
||||||
$results = [];
|
$results = [];
|
||||||
if (\count($searchProperties) === 0) {
|
if (\count($searchProperties) === 0) {
|
||||||
return [];
|
return [];
|
||||||
|
@ -370,7 +370,7 @@ abstract class AbstractPrincipalBackend implements BackendInterface {
|
||||||
* @param string $principalPrefix
|
* @param string $principalPrefix
|
||||||
* @return null|string
|
* @return null|string
|
||||||
*/
|
*/
|
||||||
function findByUri($uri, $principalPrefix) {
|
public function findByUri($uri, $principalPrefix) {
|
||||||
$user = $this->userSession->getUser();
|
$user = $this->userSession->getUser();
|
||||||
if (!$user) {
|
if (!$user) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -62,7 +62,7 @@ class Plugin extends \Sabre\CalDAV\Schedule\Plugin {
|
||||||
* @param Server $server
|
* @param Server $server
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function initialize(Server $server) {
|
public function initialize(Server $server) {
|
||||||
parent::initialize($server);
|
parent::initialize($server);
|
||||||
$server->on('propFind', [$this, 'propFindDefaultCalendarUrl'], 90);
|
$server->on('propFind', [$this, 'propFindDefaultCalendarUrl'], 90);
|
||||||
$server->on('afterWriteContent', [$this, 'dispatchSchedulingResponses']);
|
$server->on('afterWriteContent', [$this, 'dispatchSchedulingResponses']);
|
||||||
|
@ -78,7 +78,7 @@ class Plugin extends \Sabre\CalDAV\Schedule\Plugin {
|
||||||
* @param INode $node
|
* @param INode $node
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function propFind(PropFind $propFind, INode $node) {
|
public function propFind(PropFind $propFind, INode $node) {
|
||||||
if ($node instanceof IPrincipal) {
|
if ($node instanceof IPrincipal) {
|
||||||
// overwrite Sabre/Dav's implementation
|
// overwrite Sabre/Dav's implementation
|
||||||
$propFind->handle('{' . self::NS_CALDAV . '}calendar-user-type', function () use ($node) {
|
$propFind->handle('{' . self::NS_CALDAV . '}calendar-user-type', function () use ($node) {
|
||||||
|
@ -259,7 +259,7 @@ EOF;
|
||||||
* @param INode $node
|
* @param INode $node
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function propFindDefaultCalendarUrl(PropFind $propFind, INode $node) {
|
public function propFindDefaultCalendarUrl(PropFind $propFind, INode $node) {
|
||||||
if ($node instanceof IPrincipal) {
|
if ($node instanceof IPrincipal) {
|
||||||
$propFind->handle('{' . self::NS_CALDAV . '}schedule-default-calendar-URL', function () use ($node) {
|
$propFind->handle('{' . self::NS_CALDAV . '}schedule-default-calendar-URL', function () use ($node) {
|
||||||
/** @var \OCA\DAV\CalDAV\Plugin $caldavPlugin */
|
/** @var \OCA\DAV\CalDAV\Plugin $caldavPlugin */
|
||||||
|
|
|
@ -36,7 +36,7 @@ class CompFilter implements XmlDeserializable {
|
||||||
* @throws BadRequest
|
* @throws BadRequest
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
static function xmlDeserialize(Reader $reader) {
|
public static function xmlDeserialize(Reader $reader) {
|
||||||
$att = $reader->parseAttributes();
|
$att = $reader->parseAttributes();
|
||||||
$componentName = $att['name'];
|
$componentName = $att['name'];
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ class LimitFilter implements XmlDeserializable {
|
||||||
* @throws BadRequest
|
* @throws BadRequest
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
static function xmlDeserialize(Reader $reader) {
|
public static function xmlDeserialize(Reader $reader) {
|
||||||
$value = $reader->parseInnerTree();
|
$value = $reader->parseInnerTree();
|
||||||
if (!is_int($value) && !is_string($value)) {
|
if (!is_int($value) && !is_string($value)) {
|
||||||
throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}limit has illegal value');
|
throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}limit has illegal value');
|
||||||
|
|
|
@ -37,7 +37,7 @@ class OffsetFilter implements XmlDeserializable {
|
||||||
* @throws BadRequest
|
* @throws BadRequest
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
static function xmlDeserialize(Reader $reader) {
|
public static function xmlDeserialize(Reader $reader) {
|
||||||
$value = $reader->parseInnerTree();
|
$value = $reader->parseInnerTree();
|
||||||
if (!is_int($value) && !is_string($value)) {
|
if (!is_int($value) && !is_string($value)) {
|
||||||
throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}offset has illegal value');
|
throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}offset has illegal value');
|
||||||
|
|
|
@ -36,7 +36,7 @@ class ParamFilter implements XmlDeserializable {
|
||||||
* @throws BadRequest
|
* @throws BadRequest
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
static function xmlDeserialize(Reader $reader) {
|
public static function xmlDeserialize(Reader $reader) {
|
||||||
$att = $reader->parseAttributes();
|
$att = $reader->parseAttributes();
|
||||||
$property = $att['property'];
|
$property = $att['property'];
|
||||||
$parameter = $att['name'];
|
$parameter = $att['name'];
|
||||||
|
|
|
@ -36,7 +36,7 @@ class PropFilter implements XmlDeserializable {
|
||||||
* @throws BadRequest
|
* @throws BadRequest
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
static function xmlDeserialize(Reader $reader) {
|
public static function xmlDeserialize(Reader $reader) {
|
||||||
$att = $reader->parseAttributes();
|
$att = $reader->parseAttributes();
|
||||||
$componentName = $att['name'];
|
$componentName = $att['name'];
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ class SearchTermFilter implements XmlDeserializable {
|
||||||
* @throws BadRequest
|
* @throws BadRequest
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
static function xmlDeserialize(Reader $reader) {
|
public static function xmlDeserialize(Reader $reader) {
|
||||||
$value = $reader->parseInnerTree();
|
$value = $reader->parseInnerTree();
|
||||||
if (!is_string($value)) {
|
if (!is_string($value)) {
|
||||||
throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}search-term has illegal value');
|
throw new BadRequest('The {' . SearchPlugin::NS_Nextcloud . '}search-term has illegal value');
|
||||||
|
|
|
@ -84,7 +84,7 @@ class CalendarSearchReport implements XmlDeserializable {
|
||||||
* @param Reader $reader
|
* @param Reader $reader
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
static function xmlDeserialize(Reader $reader) {
|
public static function xmlDeserialize(Reader $reader) {
|
||||||
$elems = $reader->parseInnerTree([
|
$elems = $reader->parseInnerTree([
|
||||||
'{http://nextcloud.com/ns}comp-filter' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\CompFilter',
|
'{http://nextcloud.com/ns}comp-filter' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\CompFilter',
|
||||||
'{http://nextcloud.com/ns}prop-filter' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\PropFilter',
|
'{http://nextcloud.com/ns}prop-filter' => 'OCA\\DAV\\CalDAV\\Search\\Xml\\Filter\\PropFilter',
|
||||||
|
|
|
@ -56,11 +56,11 @@ class AddressBookRoot extends \Sabre\CardDAV\AddressBookRoot {
|
||||||
*
|
*
|
||||||
* @return \Sabre\DAV\INode
|
* @return \Sabre\DAV\INode
|
||||||
*/
|
*/
|
||||||
function getChildForPrincipal(array $principal) {
|
public function getChildForPrincipal(array $principal) {
|
||||||
return new UserAddressBooks($this->carddavBackend, $principal['uri'], $this->pluginManager);
|
return new UserAddressBooks($this->carddavBackend, $principal['uri'], $this->pluginManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getName() {
|
public function getName() {
|
||||||
if ($this->principalPrefix === 'principals') {
|
if ($this->principalPrefix === 'principals') {
|
||||||
return parent::getName();
|
return parent::getName();
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,7 +143,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
||||||
* @param string $principalUri
|
* @param string $principalUri
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getAddressBooksForUser($principalUri) {
|
public function getAddressBooksForUser($principalUri) {
|
||||||
$principalUriOriginal = $principalUri;
|
$principalUriOriginal = $principalUri;
|
||||||
$principalUri = $this->convertPrincipal($principalUri, true);
|
$principalUri = $this->convertPrincipal($principalUri, true);
|
||||||
$query = $this->db->getQueryBuilder();
|
$query = $this->db->getQueryBuilder();
|
||||||
|
@ -353,7 +353,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
||||||
* @param \Sabre\DAV\PropPatch $propPatch
|
* @param \Sabre\DAV\PropPatch $propPatch
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch) {
|
public function updateAddressBook($addressBookId, \Sabre\DAV\PropPatch $propPatch) {
|
||||||
$supportedProperties = [
|
$supportedProperties = [
|
||||||
'{DAV:}displayname',
|
'{DAV:}displayname',
|
||||||
'{' . Plugin::NS_CARDDAV . '}addressbook-description',
|
'{' . Plugin::NS_CARDDAV . '}addressbook-description',
|
||||||
|
@ -398,7 +398,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
||||||
* @return int
|
* @return int
|
||||||
* @throws BadRequest
|
* @throws BadRequest
|
||||||
*/
|
*/
|
||||||
function createAddressBook($principalUri, $url, array $properties) {
|
public function createAddressBook($principalUri, $url, array $properties) {
|
||||||
$values = [
|
$values = [
|
||||||
'displayname' => null,
|
'displayname' => null,
|
||||||
'description' => null,
|
'description' => null,
|
||||||
|
@ -447,7 +447,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
||||||
* @param mixed $addressBookId
|
* @param mixed $addressBookId
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function deleteAddressBook($addressBookId) {
|
public function deleteAddressBook($addressBookId) {
|
||||||
$query = $this->db->getQueryBuilder();
|
$query = $this->db->getQueryBuilder();
|
||||||
$query->delete('cards')
|
$query->delete('cards')
|
||||||
->where($query->expr()->eq('addressbookid', $query->createParameter('addressbookid')))
|
->where($query->expr()->eq('addressbookid', $query->createParameter('addressbookid')))
|
||||||
|
@ -490,7 +490,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
||||||
* @param mixed $addressBookId
|
* @param mixed $addressBookId
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getCards($addressBookId) {
|
public function getCards($addressBookId) {
|
||||||
$query = $this->db->getQueryBuilder();
|
$query = $this->db->getQueryBuilder();
|
||||||
$query->select(['id', 'uri', 'lastmodified', 'etag', 'size', 'carddata', 'uid'])
|
$query->select(['id', 'uri', 'lastmodified', 'etag', 'size', 'carddata', 'uid'])
|
||||||
->from('cards')
|
->from('cards')
|
||||||
|
@ -521,7 +521,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
||||||
* @param string $cardUri
|
* @param string $cardUri
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getCard($addressBookId, $cardUri) {
|
public function getCard($addressBookId, $cardUri) {
|
||||||
$query = $this->db->getQueryBuilder();
|
$query = $this->db->getQueryBuilder();
|
||||||
$query->select(['id', 'uri', 'lastmodified', 'etag', 'size', 'carddata', 'uid'])
|
$query->select(['id', 'uri', 'lastmodified', 'etag', 'size', 'carddata', 'uid'])
|
||||||
->from('cards')
|
->from('cards')
|
||||||
|
@ -552,7 +552,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
||||||
* @param string[] $uris
|
* @param string[] $uris
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getMultipleCards($addressBookId, array $uris) {
|
public function getMultipleCards($addressBookId, array $uris) {
|
||||||
if (empty($uris)) {
|
if (empty($uris)) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
@ -605,7 +605,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
||||||
* @param string $cardData
|
* @param string $cardData
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function createCard($addressBookId, $cardUri, $cardData) {
|
public function createCard($addressBookId, $cardUri, $cardData) {
|
||||||
$etag = md5($cardData);
|
$etag = md5($cardData);
|
||||||
$uid = $this->getUID($cardData);
|
$uid = $this->getUID($cardData);
|
||||||
|
|
||||||
|
@ -672,7 +672,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
||||||
* @param string $cardData
|
* @param string $cardData
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function updateCard($addressBookId, $cardUri, $cardData) {
|
public function updateCard($addressBookId, $cardUri, $cardData) {
|
||||||
$uid = $this->getUID($cardData);
|
$uid = $this->getUID($cardData);
|
||||||
$etag = md5($cardData);
|
$etag = md5($cardData);
|
||||||
$query = $this->db->getQueryBuilder();
|
$query = $this->db->getQueryBuilder();
|
||||||
|
@ -705,7 +705,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
||||||
* @param string $cardUri
|
* @param string $cardUri
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function deleteCard($addressBookId, $cardUri) {
|
public function deleteCard($addressBookId, $cardUri) {
|
||||||
try {
|
try {
|
||||||
$cardId = $this->getCardId($addressBookId, $cardUri);
|
$cardId = $this->getCardId($addressBookId, $cardUri);
|
||||||
} catch (\InvalidArgumentException $e) {
|
} catch (\InvalidArgumentException $e) {
|
||||||
|
@ -790,7 +790,7 @@ class CardDavBackend implements BackendInterface, SyncSupport {
|
||||||
* @param int $limit
|
* @param int $limit
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getChangesForAddressBook($addressBookId, $syncToken, $syncLevel, $limit = null) {
|
public function getChangesForAddressBook($addressBookId, $syncToken, $syncLevel, $limit = null) {
|
||||||
// Current synctoken
|
// Current synctoken
|
||||||
$stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*addressbooks` WHERE `id` = ?');
|
$stmt = $this->db->prepare('SELECT `synctoken` FROM `*PREFIX*addressbooks` WHERE `id` = ?');
|
||||||
$stmt->execute([ $addressBookId ]);
|
$stmt->execute([ $addressBookId ]);
|
||||||
|
|
|
@ -45,7 +45,7 @@ class HasPhotoPlugin extends ServerPlugin {
|
||||||
* @param Server $server
|
* @param Server $server
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function initialize(Server $server) {
|
public function initialize(Server $server) {
|
||||||
$server->on('propFind', [$this, 'propFind']);
|
$server->on('propFind', [$this, 'propFind']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ class HasPhotoPlugin extends ServerPlugin {
|
||||||
* @param INode $node
|
* @param INode $node
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function propFind(PropFind $propFind, INode $node) {
|
public function propFind(PropFind $propFind, INode $node) {
|
||||||
$ns = '{http://nextcloud.com/ns}';
|
$ns = '{http://nextcloud.com/ns}';
|
||||||
|
|
||||||
if ($node instanceof Card) {
|
if ($node instanceof Card) {
|
||||||
|
|
|
@ -30,7 +30,7 @@ use Sabre\DAV\PropFind;
|
||||||
use Sabre\DAV\Server;
|
use Sabre\DAV\Server;
|
||||||
|
|
||||||
class Plugin extends \Sabre\CardDAV\Plugin {
|
class Plugin extends \Sabre\CardDAV\Plugin {
|
||||||
function initialize(Server $server) {
|
public function initialize(Server $server) {
|
||||||
$server->on('propFind', [$this, 'propFind']);
|
$server->on('propFind', [$this, 'propFind']);
|
||||||
parent::initialize($server);
|
parent::initialize($server);
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ class Plugin extends \Sabre\CardDAV\Plugin {
|
||||||
* @param INode $node
|
* @param INode $node
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function propFind(PropFind $propFind, INode $node) {
|
public function propFind(PropFind $propFind, INode $node) {
|
||||||
$ns = '{http://owncloud.org/ns}';
|
$ns = '{http://owncloud.org/ns}';
|
||||||
|
|
||||||
if ($node instanceof AddressBook) {
|
if ($node instanceof AddressBook) {
|
||||||
|
|
|
@ -62,7 +62,7 @@ class UserAddressBooks extends \Sabre\CardDAV\AddressBookHome {
|
||||||
*
|
*
|
||||||
* @return IAddressBook[]
|
* @return IAddressBook[]
|
||||||
*/
|
*/
|
||||||
function getChildren() {
|
public function getChildren() {
|
||||||
if ($this->l10n === null) {
|
if ($this->l10n === null) {
|
||||||
$this->l10n = \OC::$server->getL10N('dav');
|
$this->l10n = \OC::$server->getL10N('dav');
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ class UserAddressBooks extends \Sabre\CardDAV\AddressBookHome {
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getACL() {
|
public function getACL() {
|
||||||
$acl = parent::getACL();
|
$acl = parent::getACL();
|
||||||
if ($this->principalUri === 'principals/system/system') {
|
if ($this->principalUri === 'principals/system/system') {
|
||||||
$acl[] = [
|
$acl[] = [
|
||||||
|
|
|
@ -39,7 +39,7 @@ class Groups implements XmlSerializable {
|
||||||
$this->groups = $groups;
|
$this->groups = $groups;
|
||||||
}
|
}
|
||||||
|
|
||||||
function xmlSerialize(Writer $writer) {
|
public function xmlSerialize(Writer $writer) {
|
||||||
foreach ($this->groups as $group) {
|
foreach ($this->groups as $group) {
|
||||||
$writer->writeElement('{' . self::NS_OWNCLOUD . '}group', $group);
|
$writer->writeElement('{' . self::NS_OWNCLOUD . '}group', $group);
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ class CreateAddressBook extends Command {
|
||||||
* @param IUserManager $userManager
|
* @param IUserManager $userManager
|
||||||
* @param CardDavBackend $cardDavBackend
|
* @param CardDavBackend $cardDavBackend
|
||||||
*/
|
*/
|
||||||
function __construct(IUserManager $userManager,
|
public function __construct(IUserManager $userManager,
|
||||||
CardDavBackend $cardDavBackend
|
CardDavBackend $cardDavBackend
|
||||||
) {
|
) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
|
@ -53,7 +53,7 @@ class CreateCalendar extends Command {
|
||||||
* @param IGroupManager $groupManager
|
* @param IGroupManager $groupManager
|
||||||
* @param IDBConnection $dbConnection
|
* @param IDBConnection $dbConnection
|
||||||
*/
|
*/
|
||||||
function __construct(IUserManager $userManager, IGroupManager $groupManager, IDBConnection $dbConnection) {
|
public function __construct(IUserManager $userManager, IGroupManager $groupManager, IDBConnection $dbConnection) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->userManager = $userManager;
|
$this->userManager = $userManager;
|
||||||
$this->groupManager = $groupManager;
|
$this->groupManager = $groupManager;
|
||||||
|
|
|
@ -46,7 +46,7 @@ class ListCalendars extends Command {
|
||||||
* @param IUserManager $userManager
|
* @param IUserManager $userManager
|
||||||
* @param CalDavBackend $caldav
|
* @param CalDavBackend $caldav
|
||||||
*/
|
*/
|
||||||
function __construct(IUserManager $userManager, CalDavBackend $caldav) {
|
public function __construct(IUserManager $userManager, CalDavBackend $caldav) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->userManager = $userManager;
|
$this->userManager = $userManager;
|
||||||
$this->caldav = $caldav;
|
$this->caldav = $caldav;
|
||||||
|
|
|
@ -72,7 +72,7 @@ class MoveCalendar extends Command {
|
||||||
* @param IL10N $l10n
|
* @param IL10N $l10n
|
||||||
* @param CalDavBackend $calDav
|
* @param CalDavBackend $calDav
|
||||||
*/
|
*/
|
||||||
function __construct(
|
public function __construct(
|
||||||
IUserManager $userManager,
|
IUserManager $userManager,
|
||||||
IGroupManager $groupManager,
|
IGroupManager $groupManager,
|
||||||
IShareManager $shareManager,
|
IShareManager $shareManager,
|
||||||
|
|
|
@ -52,7 +52,7 @@ class SyncBirthdayCalendar extends Command {
|
||||||
* @param IConfig $config
|
* @param IConfig $config
|
||||||
* @param BirthdayService $birthdayService
|
* @param BirthdayService $birthdayService
|
||||||
*/
|
*/
|
||||||
function __construct(IUserManager $userManager, IConfig $config,
|
public function __construct(IUserManager $userManager, IConfig $config,
|
||||||
BirthdayService $birthdayService) {
|
BirthdayService $birthdayService) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->birthdayService = $birthdayService;
|
$this->birthdayService = $birthdayService;
|
||||||
|
|
|
@ -37,7 +37,7 @@ class SyncSystemAddressBook extends Command {
|
||||||
/**
|
/**
|
||||||
* @param SyncService $syncService
|
* @param SyncService $syncService
|
||||||
*/
|
*/
|
||||||
function __construct(SyncService $syncService) {
|
public function __construct(SyncService $syncService) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->syncService = $syncService;
|
$this->syncService = $syncService;
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,7 +104,7 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties {
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
static public function getPropertyNames() {
|
public static function getPropertyNames() {
|
||||||
return [
|
return [
|
||||||
'{http://owncloud.org/ns}id',
|
'{http://owncloud.org/ns}id',
|
||||||
'{http://owncloud.org/ns}parentId',
|
'{http://owncloud.org/ns}parentId',
|
||||||
|
@ -144,7 +144,7 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties {
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function delete() {
|
public function delete() {
|
||||||
$this->checkWriteAccessOnComment();
|
$this->checkWriteAccessOnComment();
|
||||||
$this->commentsManager->delete($this->comment->getId());
|
$this->commentsManager->delete($this->comment->getId());
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties {
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function getName() {
|
public function getName() {
|
||||||
return $this->comment->getId();
|
return $this->comment->getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties {
|
||||||
* @param string $name The new name
|
* @param string $name The new name
|
||||||
* @throws MethodNotAllowed
|
* @throws MethodNotAllowed
|
||||||
*/
|
*/
|
||||||
function setName($name) {
|
public function setName($name) {
|
||||||
throw new MethodNotAllowed();
|
throw new MethodNotAllowed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,7 +175,7 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties {
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function getLastModified() {
|
public function getLastModified() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,7 +215,7 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties {
|
||||||
* @param PropPatch $propPatch
|
* @param PropPatch $propPatch
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function propPatch(PropPatch $propPatch) {
|
public function propPatch(PropPatch $propPatch) {
|
||||||
// other properties than 'message' are read only
|
// other properties than 'message' are read only
|
||||||
$propPatch->handle(self::PROPERTY_NAME_MESSAGE, [$this, 'updateComment']);
|
$propPatch->handle(self::PROPERTY_NAME_MESSAGE, [$this, 'updateComment']);
|
||||||
}
|
}
|
||||||
|
@ -235,7 +235,7 @@ class CommentNode implements \Sabre\DAV\INode, \Sabre\DAV\IProperties {
|
||||||
* @param array $properties
|
* @param array $properties
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getProperties($properties) {
|
public function getProperties($properties) {
|
||||||
$properties = array_keys($this->properties);
|
$properties = array_keys($this->properties);
|
||||||
|
|
||||||
$result = [];
|
$result = [];
|
||||||
|
|
|
@ -83,7 +83,7 @@ class CommentsPlugin extends ServerPlugin {
|
||||||
* @param Server $server
|
* @param Server $server
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function initialize(Server $server) {
|
public function initialize(Server $server) {
|
||||||
$this->server = $server;
|
$this->server = $server;
|
||||||
if (strpos($this->server->getRequestUri(), 'comments/') !== 0) {
|
if (strpos($this->server->getRequestUri(), 'comments/') !== 0) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -98,7 +98,7 @@ class EntityCollection extends RootCollection implements IProperties {
|
||||||
* @return \Sabre\DAV\INode
|
* @return \Sabre\DAV\INode
|
||||||
* @throws NotFound
|
* @throws NotFound
|
||||||
*/
|
*/
|
||||||
function getChild($name) {
|
public function getChild($name) {
|
||||||
try {
|
try {
|
||||||
$comment = $this->commentsManager->get($name);
|
$comment = $this->commentsManager->get($name);
|
||||||
return new CommentNode(
|
return new CommentNode(
|
||||||
|
@ -118,7 +118,7 @@ class EntityCollection extends RootCollection implements IProperties {
|
||||||
*
|
*
|
||||||
* @return \Sabre\DAV\INode[]
|
* @return \Sabre\DAV\INode[]
|
||||||
*/
|
*/
|
||||||
function getChildren() {
|
public function getChildren() {
|
||||||
return $this->findChildren();
|
return $this->findChildren();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ class EntityCollection extends RootCollection implements IProperties {
|
||||||
* @param \DateTime|null $datetime
|
* @param \DateTime|null $datetime
|
||||||
* @return CommentNode[]
|
* @return CommentNode[]
|
||||||
*/
|
*/
|
||||||
function findChildren($limit = 0, $offset = 0, \DateTime $datetime = null) {
|
public function findChildren($limit = 0, $offset = 0, \DateTime $datetime = null) {
|
||||||
$comments = $this->commentsManager->getForObject($this->name, $this->id, $limit, $offset, $datetime);
|
$comments = $this->commentsManager->getForObject($this->name, $this->id, $limit, $offset, $datetime);
|
||||||
$result = [];
|
$result = [];
|
||||||
foreach ($comments as $comment) {
|
foreach ($comments as $comment) {
|
||||||
|
@ -152,7 +152,7 @@ class EntityCollection extends RootCollection implements IProperties {
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function childExists($name) {
|
public function childExists($name) {
|
||||||
try {
|
try {
|
||||||
$this->commentsManager->get($name);
|
$this->commentsManager->get($name);
|
||||||
return true;
|
return true;
|
||||||
|
@ -177,14 +177,14 @@ class EntityCollection extends RootCollection implements IProperties {
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
function propPatch(PropPatch $propPatch) {
|
public function propPatch(PropPatch $propPatch) {
|
||||||
$propPatch->handle(self::PROPERTY_NAME_READ_MARKER, [$this, 'setReadMarker']);
|
$propPatch->handle(self::PROPERTY_NAME_READ_MARKER, [$this, 'setReadMarker']);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
function getProperties($properties) {
|
public function getProperties($properties) {
|
||||||
$marker = null;
|
$marker = null;
|
||||||
$user = $this->userSession->getUser();
|
$user = $this->userSession->getUser();
|
||||||
if (!is_null($user)) {
|
if (!is_null($user)) {
|
||||||
|
|
|
@ -90,7 +90,7 @@ class EntityTypeCollection extends RootCollection {
|
||||||
* @return \Sabre\DAV\INode
|
* @return \Sabre\DAV\INode
|
||||||
* @throws NotFound
|
* @throws NotFound
|
||||||
*/
|
*/
|
||||||
function getChild($name) {
|
public function getChild($name) {
|
||||||
if (!$this->childExists($name)) {
|
if (!$this->childExists($name)) {
|
||||||
throw new NotFound('Entity does not exist or is not available');
|
throw new NotFound('Entity does not exist or is not available');
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,7 @@ class EntityTypeCollection extends RootCollection {
|
||||||
* @return \Sabre\DAV\INode[]
|
* @return \Sabre\DAV\INode[]
|
||||||
* @throws MethodNotAllowed
|
* @throws MethodNotAllowed
|
||||||
*/
|
*/
|
||||||
function getChildren() {
|
public function getChildren() {
|
||||||
throw new MethodNotAllowed('No permission to list folder contents');
|
throw new MethodNotAllowed('No permission to list folder contents');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ class EntityTypeCollection extends RootCollection {
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function childExists($name) {
|
public function childExists($name) {
|
||||||
return call_user_func($this->childExistsFunction, $name);
|
return call_user_func($this->childExistsFunction, $name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,7 @@ class RootCollection implements ICollection {
|
||||||
* @return null|string
|
* @return null|string
|
||||||
* @throws Forbidden
|
* @throws Forbidden
|
||||||
*/
|
*/
|
||||||
function createFile($name, $data = null) {
|
public function createFile($name, $data = null) {
|
||||||
throw new Forbidden('Cannot create comments by id');
|
throw new Forbidden('Cannot create comments by id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ class RootCollection implements ICollection {
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @throws Forbidden
|
* @throws Forbidden
|
||||||
*/
|
*/
|
||||||
function createDirectory($name) {
|
public function createDirectory($name) {
|
||||||
throw new Forbidden('Permission denied to create collections');
|
throw new Forbidden('Permission denied to create collections');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ class RootCollection implements ICollection {
|
||||||
* @return \Sabre\DAV\INode
|
* @return \Sabre\DAV\INode
|
||||||
* @throws NotFound
|
* @throws NotFound
|
||||||
*/
|
*/
|
||||||
function getChild($name) {
|
public function getChild($name) {
|
||||||
$this->initCollections();
|
$this->initCollections();
|
||||||
if (isset($this->entityTypeCollections[$name])) {
|
if (isset($this->entityTypeCollections[$name])) {
|
||||||
return $this->entityTypeCollections[$name];
|
return $this->entityTypeCollections[$name];
|
||||||
|
@ -155,7 +155,7 @@ class RootCollection implements ICollection {
|
||||||
*
|
*
|
||||||
* @return \Sabre\DAV\INode[]
|
* @return \Sabre\DAV\INode[]
|
||||||
*/
|
*/
|
||||||
function getChildren() {
|
public function getChildren() {
|
||||||
$this->initCollections();
|
$this->initCollections();
|
||||||
return $this->entityTypeCollections;
|
return $this->entityTypeCollections;
|
||||||
}
|
}
|
||||||
|
@ -166,7 +166,7 @@ class RootCollection implements ICollection {
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function childExists($name) {
|
public function childExists($name) {
|
||||||
$this->initCollections();
|
$this->initCollections();
|
||||||
return isset($this->entityTypeCollections[$name]);
|
return isset($this->entityTypeCollections[$name]);
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,7 @@ class RootCollection implements ICollection {
|
||||||
*
|
*
|
||||||
* @throws Forbidden
|
* @throws Forbidden
|
||||||
*/
|
*/
|
||||||
function delete() {
|
public function delete() {
|
||||||
throw new Forbidden('Permission denied to delete this collection');
|
throw new Forbidden('Permission denied to delete this collection');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ class RootCollection implements ICollection {
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function getName() {
|
public function getName() {
|
||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,7 +197,7 @@ class RootCollection implements ICollection {
|
||||||
* @param string $name The new name
|
* @param string $name The new name
|
||||||
* @throws Forbidden
|
* @throws Forbidden
|
||||||
*/
|
*/
|
||||||
function setName($name) {
|
public function setName($name) {
|
||||||
throw new Forbidden('Permission denied to rename this collection');
|
throw new Forbidden('Permission denied to rename this collection');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ class RootCollection implements ICollection {
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function getLastModified() {
|
public function getLastModified() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,7 +151,7 @@ class Auth extends AbstractBasic {
|
||||||
* @throws NotAuthenticated
|
* @throws NotAuthenticated
|
||||||
* @throws ServiceUnavailable
|
* @throws ServiceUnavailable
|
||||||
*/
|
*/
|
||||||
function check(RequestInterface $request, ResponseInterface $response) {
|
public function check(RequestInterface $request, ResponseInterface $response) {
|
||||||
try {
|
try {
|
||||||
return $this->auth($request, $response);
|
return $this->auth($request, $response);
|
||||||
} catch (NotAuthenticated $e) {
|
} catch (NotAuthenticated $e) {
|
||||||
|
|
|
@ -63,7 +63,7 @@ class ChecksumList implements XmlSerializable {
|
||||||
* @param Writer $writer
|
* @param Writer $writer
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function xmlSerialize(Writer $writer) {
|
public function xmlSerialize(Writer $writer) {
|
||||||
foreach ($this->checksums as $checksum) {
|
foreach ($this->checksums as $checksum) {
|
||||||
$writer->writeElement('{' . self::NS_OWNCLOUD . '}checksum', $checksum);
|
$writer->writeElement('{' . self::NS_OWNCLOUD . '}checksum', $checksum);
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ class CommentPropertiesPlugin extends ServerPlugin {
|
||||||
* @param \Sabre\DAV\Server $server
|
* @param \Sabre\DAV\Server $server
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function initialize(\Sabre\DAV\Server $server) {
|
public function initialize(\Sabre\DAV\Server $server) {
|
||||||
$this->server = $server;
|
$this->server = $server;
|
||||||
$this->server->on('propFind', [$this, 'handleGetProperties']);
|
$this->server->on('propFind', [$this, 'handleGetProperties']);
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ class CopyEtagHeaderPlugin extends \Sabre\DAV\ServerPlugin {
|
||||||
* @param string $destination
|
* @param string $destination
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function afterMove($source, $destination) {
|
public function afterMove($source, $destination) {
|
||||||
$node = $this->server->tree->getNodeForPath($destination);
|
$node = $this->server->tree->getNodeForPath($destination);
|
||||||
if ($node instanceof File) {
|
if ($node instanceof File) {
|
||||||
$eTag = $node->getETag();
|
$eTag = $node->getETag();
|
||||||
|
|
|
@ -48,7 +48,7 @@ class DavAclPlugin extends \Sabre\DAVACL\Plugin {
|
||||||
$this->allowUnauthenticatedAccess = false;
|
$this->allowUnauthenticatedAccess = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkPrivileges($uri, $privileges, $recursion = self::R_PARENT, $throwExceptions = true) {
|
public function checkPrivileges($uri, $privileges, $recursion = self::R_PARENT, $throwExceptions = true) {
|
||||||
$access = parent::checkPrivileges($uri, $privileges, $recursion, false);
|
$access = parent::checkPrivileges($uri, $privileges, $recursion, false);
|
||||||
if ($access === false && $throwExceptions) {
|
if ($access === false && $throwExceptions) {
|
||||||
/** @var INode $node */
|
/** @var INode $node */
|
||||||
|
@ -90,7 +90,7 @@ class DavAclPlugin extends \Sabre\DAVACL\Plugin {
|
||||||
return parent::propFind($propFind, $node);
|
return parent::propFind($propFind, $node);
|
||||||
}
|
}
|
||||||
|
|
||||||
function beforeMethod(RequestInterface $request, ResponseInterface $response) {
|
public function beforeMethod(RequestInterface $request, ResponseInterface $response) {
|
||||||
$path = $request->getPath();
|
$path = $request->getPath();
|
||||||
|
|
||||||
// prevent the plugin from causing an unneeded overhead for file requests
|
// prevent the plugin from causing an unneeded overhead for file requests
|
||||||
|
|
|
@ -50,7 +50,7 @@ class DummyGetResponsePlugin extends \Sabre\DAV\ServerPlugin {
|
||||||
* @param \Sabre\DAV\Server $server
|
* @param \Sabre\DAV\Server $server
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function initialize(\Sabre\DAV\Server $server) {
|
public function initialize(\Sabre\DAV\Server $server) {
|
||||||
$this->server = $server;
|
$this->server = $server;
|
||||||
$this->server->on('method:GET', [$this, 'httpGet'], 200);
|
$this->server->on('method:GET', [$this, 'httpGet'], 200);
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ class DummyGetResponsePlugin extends \Sabre\DAV\ServerPlugin {
|
||||||
* @param ResponseInterface $response
|
* @param ResponseInterface $response
|
||||||
* @return false
|
* @return false
|
||||||
*/
|
*/
|
||||||
function httpGet(RequestInterface $request, ResponseInterface $response) {
|
public function httpGet(RequestInterface $request, ResponseInterface $response) {
|
||||||
$string = 'This is the WebDAV interface. It can only be accessed by ' .
|
$string = 'This is the WebDAV interface. It can only be accessed by ' .
|
||||||
'WebDAV clients such as the Nextcloud desktop sync client.';
|
'WebDAV clients such as the Nextcloud desktop sync client.';
|
||||||
$stream = fopen('php://memory','r+');
|
$stream = fopen('php://memory','r+');
|
||||||
|
|
|
@ -77,7 +77,7 @@ class FakeLockerPlugin extends ServerPlugin {
|
||||||
*
|
*
|
||||||
* @return integer[]
|
* @return integer[]
|
||||||
*/
|
*/
|
||||||
function getFeatures() {
|
public function getFeatures() {
|
||||||
return [2];
|
return [2];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ class FakeLockerPlugin extends ServerPlugin {
|
||||||
* @param INode $node
|
* @param INode $node
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function propFind(PropFind $propFind, INode $node) {
|
public function propFind(PropFind $propFind, INode $node) {
|
||||||
$propFind->handle('{DAV:}supportedlock', function () {
|
$propFind->handle('{DAV:}supportedlock', function () {
|
||||||
return new SupportedLock(true);
|
return new SupportedLock(true);
|
||||||
});
|
});
|
||||||
|
|
|
@ -197,7 +197,7 @@ class FilesPlugin extends ServerPlugin {
|
||||||
* @throws Forbidden
|
* @throws Forbidden
|
||||||
* @throws NotFound
|
* @throws NotFound
|
||||||
*/
|
*/
|
||||||
function checkMove($source, $destination) {
|
public function checkMove($source, $destination) {
|
||||||
$sourceNode = $this->tree->getNodeForPath($source);
|
$sourceNode = $this->tree->getNodeForPath($source);
|
||||||
if (!$sourceNode instanceof Node) {
|
if (!$sourceNode instanceof Node) {
|
||||||
return;
|
return;
|
||||||
|
@ -225,7 +225,7 @@ class FilesPlugin extends ServerPlugin {
|
||||||
* @param RequestInterface $request
|
* @param RequestInterface $request
|
||||||
* @param ResponseInterface $response
|
* @param ResponseInterface $response
|
||||||
*/
|
*/
|
||||||
function handleDownloadToken(RequestInterface $request, ResponseInterface $response) {
|
public function handleDownloadToken(RequestInterface $request, ResponseInterface $response) {
|
||||||
$queryParams = $request->getQueryParameters();
|
$queryParams = $request->getQueryParameters();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -249,7 +249,7 @@ class FilesPlugin extends ServerPlugin {
|
||||||
* @param RequestInterface $request
|
* @param RequestInterface $request
|
||||||
* @param ResponseInterface $response
|
* @param ResponseInterface $response
|
||||||
*/
|
*/
|
||||||
function httpGet(RequestInterface $request, ResponseInterface $response) {
|
public function httpGet(RequestInterface $request, ResponseInterface $response) {
|
||||||
// Only handle valid files
|
// Only handle valid files
|
||||||
$node = $this->tree->getNodeForPath($request->getPath());
|
$node = $this->tree->getNodeForPath($request->getPath());
|
||||||
if (!($node instanceof IFile)) {
|
if (!($node instanceof IFile)) {
|
||||||
|
|
|
@ -224,7 +224,7 @@ class Principal implements BackendInterface {
|
||||||
* @param PropPatch $propPatch
|
* @param PropPatch $propPatch
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function updatePrincipal($path, PropPatch $propPatch) {
|
public function updatePrincipal($path, PropPatch $propPatch) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -371,7 +371,7 @@ class Principal implements BackendInterface {
|
||||||
* @param string $test
|
* @param string $test
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function searchPrincipals($prefixPath, array $searchProperties, $test = 'allof') {
|
public function searchPrincipals($prefixPath, array $searchProperties, $test = 'allof') {
|
||||||
if (count($searchProperties) === 0) {
|
if (count($searchProperties) === 0) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
@ -390,7 +390,7 @@ class Principal implements BackendInterface {
|
||||||
* @param string $principalPrefix
|
* @param string $principalPrefix
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function findByUri($uri, $principalPrefix) {
|
public function findByUri($uri, $principalPrefix) {
|
||||||
// If sharing is disabled, return the empty array
|
// If sharing is disabled, return the empty array
|
||||||
$shareAPIEnabled = $this->shareManager->shareApiEnabled();
|
$shareAPIEnabled = $this->shareManager->shareApiEnabled();
|
||||||
if (!$shareAPIEnabled) {
|
if (!$shareAPIEnabled) {
|
||||||
|
|
|
@ -63,7 +63,7 @@ class ShareTypeList implements Element {
|
||||||
* @param Reader $reader
|
* @param Reader $reader
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
static function xmlDeserialize(Reader $reader) {
|
public static function xmlDeserialize(Reader $reader) {
|
||||||
$shareTypes = [];
|
$shareTypes = [];
|
||||||
|
|
||||||
$tree = $reader->parseInnerTree();
|
$tree = $reader->parseInnerTree();
|
||||||
|
@ -84,7 +84,7 @@ class ShareTypeList implements Element {
|
||||||
* @param Writer $writer
|
* @param Writer $writer
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function xmlSerialize(Writer $writer) {
|
public function xmlSerialize(Writer $writer) {
|
||||||
foreach ($this->shareTypes as $shareType) {
|
foreach ($this->shareTypes as $shareType) {
|
||||||
$writer->writeElement('{' . self::NS_OWNCLOUD . '}share-type', $shareType);
|
$writer->writeElement('{' . self::NS_OWNCLOUD . '}share-type', $shareType);
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ class ShareeList implements XmlSerializable {
|
||||||
* @param Writer $writer
|
* @param Writer $writer
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function xmlSerialize(Writer $writer) {
|
public function xmlSerialize(Writer $writer) {
|
||||||
foreach ($this->shares as $share) {
|
foreach ($this->shares as $share) {
|
||||||
$writer->startElement('{' . self::NS_NEXTCLOUD . '}sharee');
|
$writer->startElement('{' . self::NS_NEXTCLOUD . '}sharee');
|
||||||
$writer->writeElement('{' . self::NS_NEXTCLOUD . '}id', $share->getSharedWith());
|
$writer->writeElement('{' . self::NS_NEXTCLOUD . '}id', $share->getSharedWith());
|
||||||
|
|
|
@ -80,7 +80,7 @@ class TagList implements Element {
|
||||||
* @param Reader $reader
|
* @param Reader $reader
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
static function xmlDeserialize(Reader $reader) {
|
public static function xmlDeserialize(Reader $reader) {
|
||||||
$tags = [];
|
$tags = [];
|
||||||
|
|
||||||
$tree = $reader->parseInnerTree();
|
$tree = $reader->parseInnerTree();
|
||||||
|
@ -114,7 +114,7 @@ class TagList implements Element {
|
||||||
* @param Writer $writer
|
* @param Writer $writer
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function xmlSerialize(Writer $writer) {
|
public function xmlSerialize(Writer $writer) {
|
||||||
foreach ($this->tags as $tag) {
|
foreach ($this->tags as $tag) {
|
||||||
$writer->writeElement('{' . self::NS_OWNCLOUD . '}tag', $tag);
|
$writer->writeElement('{' . self::NS_OWNCLOUD . '}tag', $tag);
|
||||||
}
|
}
|
||||||
|
|
|
@ -167,7 +167,7 @@ class GroupPrincipalBackend implements BackendInterface {
|
||||||
* @param PropPatch $propPatch
|
* @param PropPatch $propPatch
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function updatePrincipal($path, PropPatch $propPatch) {
|
public function updatePrincipal($path, PropPatch $propPatch) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ class GroupPrincipalBackend implements BackendInterface {
|
||||||
* @param string $test
|
* @param string $test
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function searchPrincipals($prefixPath, array $searchProperties, $test = 'allof') {
|
public function searchPrincipals($prefixPath, array $searchProperties, $test = 'allof') {
|
||||||
$results = [];
|
$results = [];
|
||||||
|
|
||||||
if (\count($searchProperties) === 0) {
|
if (\count($searchProperties) === 0) {
|
||||||
|
@ -257,7 +257,7 @@ class GroupPrincipalBackend implements BackendInterface {
|
||||||
* @param string $principalPrefix
|
* @param string $principalPrefix
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function findByUri($uri, $principalPrefix) {
|
public function findByUri($uri, $principalPrefix) {
|
||||||
// If sharing is disabled, return the empty array
|
// If sharing is disabled, return the empty array
|
||||||
$shareAPIEnabled = $this->shareManager->shareApiEnabled();
|
$shareAPIEnabled = $this->shareManager->shareApiEnabled();
|
||||||
if (!$shareAPIEnabled) {
|
if (!$shareAPIEnabled) {
|
||||||
|
|
|
@ -67,7 +67,7 @@ class PublicAuth implements BackendInterface {
|
||||||
* @param ResponseInterface $response
|
* @param ResponseInterface $response
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function check(RequestInterface $request, ResponseInterface $response) {
|
public function check(RequestInterface $request, ResponseInterface $response) {
|
||||||
if ($this->isRequestPublic($request)) {
|
if ($this->isRequestPublic($request)) {
|
||||||
return [true, "principals/system/public"];
|
return [true, "principals/system/public"];
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ class PublicAuth implements BackendInterface {
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
function challenge(RequestInterface $request, ResponseInterface $response) {
|
public function challenge(RequestInterface $request, ResponseInterface $response) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -49,7 +49,7 @@ interface IShareable extends INode {
|
||||||
* @param array $remove
|
* @param array $remove
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function updateShares(array $add, array $remove);
|
public function updateShares(array $add, array $remove);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the list of people whom this resource is shared with.
|
* Returns the list of people whom this resource is shared with.
|
||||||
|
@ -63,7 +63,7 @@ interface IShareable extends INode {
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getShares();
|
public function getShares();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return int
|
* @return int
|
||||||
|
|
|
@ -72,7 +72,7 @@ class Plugin extends ServerPlugin {
|
||||||
*
|
*
|
||||||
* @return string[]
|
* @return string[]
|
||||||
*/
|
*/
|
||||||
function getFeatures() {
|
public function getFeatures() {
|
||||||
return ['oc-resource-sharing'];
|
return ['oc-resource-sharing'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ class Plugin extends ServerPlugin {
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function getPluginName() {
|
public function getPluginName() {
|
||||||
return 'oc-resource-sharing';
|
return 'oc-resource-sharing';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ class Plugin extends ServerPlugin {
|
||||||
* @param Server $server
|
* @param Server $server
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function initialize(Server $server) {
|
public function initialize(Server $server) {
|
||||||
$this->server = $server;
|
$this->server = $server;
|
||||||
$this->server->xml->elementMap['{' . Plugin::NS_OWNCLOUD . '}share'] = ShareRequest::class;
|
$this->server->xml->elementMap['{' . Plugin::NS_OWNCLOUD . '}share'] = ShareRequest::class;
|
||||||
$this->server->xml->elementMap['{' . Plugin::NS_OWNCLOUD . '}invite'] = Invite::class;
|
$this->server->xml->elementMap['{' . Plugin::NS_OWNCLOUD . '}invite'] = Invite::class;
|
||||||
|
@ -115,7 +115,7 @@ class Plugin extends ServerPlugin {
|
||||||
* @param ResponseInterface $response
|
* @param ResponseInterface $response
|
||||||
* @return null|false
|
* @return null|false
|
||||||
*/
|
*/
|
||||||
function httpPost(RequestInterface $request, ResponseInterface $response) {
|
public function httpPost(RequestInterface $request, ResponseInterface $response) {
|
||||||
$path = $request->getPath();
|
$path = $request->getPath();
|
||||||
|
|
||||||
// Only handling xml
|
// Only handling xml
|
||||||
|
@ -188,7 +188,7 @@ class Plugin extends ServerPlugin {
|
||||||
* @param INode $node
|
* @param INode $node
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function propFind(PropFind $propFind, INode $node) {
|
public function propFind(PropFind $propFind, INode $node) {
|
||||||
if ($node instanceof IShareable) {
|
if ($node instanceof IShareable) {
|
||||||
$propFind->handle('{' . Plugin::NS_OWNCLOUD . '}invite', function () use ($node) {
|
$propFind->handle('{' . Plugin::NS_OWNCLOUD . '}invite', function () use ($node) {
|
||||||
return new Invite(
|
return new Invite(
|
||||||
|
|
|
@ -84,7 +84,7 @@ class Invite implements XmlSerializable {
|
||||||
*
|
*
|
||||||
* @param array $users
|
* @param array $users
|
||||||
*/
|
*/
|
||||||
function __construct(array $users, array $organizer = null) {
|
public function __construct(array $users, array $organizer = null) {
|
||||||
$this->users = $users;
|
$this->users = $users;
|
||||||
$this->organizer = $organizer;
|
$this->organizer = $organizer;
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ class Invite implements XmlSerializable {
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getValue() {
|
public function getValue() {
|
||||||
return $this->users;
|
return $this->users;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ class Invite implements XmlSerializable {
|
||||||
* @param Writer $writer
|
* @param Writer $writer
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function xmlSerialize(Writer $writer) {
|
public function xmlSerialize(Writer $writer) {
|
||||||
$cs = '{' . Plugin::NS_OWNCLOUD . '}';
|
$cs = '{' . Plugin::NS_OWNCLOUD . '}';
|
||||||
|
|
||||||
if (!is_null($this->organizer)) {
|
if (!is_null($this->organizer)) {
|
||||||
|
|
|
@ -38,12 +38,12 @@ class ShareRequest implements XmlDeserializable {
|
||||||
* @param array $set
|
* @param array $set
|
||||||
* @param array $remove
|
* @param array $remove
|
||||||
*/
|
*/
|
||||||
function __construct(array $set, array $remove) {
|
public function __construct(array $set, array $remove) {
|
||||||
$this->set = $set;
|
$this->set = $set;
|
||||||
$this->remove = $remove;
|
$this->remove = $remove;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function xmlDeserialize(Reader $reader) {
|
public static function xmlDeserialize(Reader $reader) {
|
||||||
$elements = $reader->parseInnerTree([
|
$elements = $reader->parseInnerTree([
|
||||||
'{' . Plugin::NS_OWNCLOUD. '}set' => 'Sabre\\Xml\\Element\\KeyValue',
|
'{' . Plugin::NS_OWNCLOUD. '}set' => 'Sabre\\Xml\\Element\\KeyValue',
|
||||||
'{' . Plugin::NS_OWNCLOUD . '}remove' => 'Sabre\\Xml\\Element\\KeyValue',
|
'{' . Plugin::NS_OWNCLOUD . '}remove' => 'Sabre\\Xml\\Element\\KeyValue',
|
||||||
|
|
|
@ -43,7 +43,7 @@ class SystemPrincipalBackend extends AbstractBackend {
|
||||||
* @param string $prefixPath
|
* @param string $prefixPath
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getPrincipalsByPrefix($prefixPath) {
|
public function getPrincipalsByPrefix($prefixPath) {
|
||||||
$principals = [];
|
$principals = [];
|
||||||
|
|
||||||
if ($prefixPath === 'principals/system') {
|
if ($prefixPath === 'principals/system') {
|
||||||
|
@ -68,7 +68,7 @@ class SystemPrincipalBackend extends AbstractBackend {
|
||||||
* @param string $path
|
* @param string $path
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getPrincipalByPath($path) {
|
public function getPrincipalByPath($path) {
|
||||||
if ($path === 'principals/system/system') {
|
if ($path === 'principals/system/system') {
|
||||||
$principal = [
|
$principal = [
|
||||||
'uri' => 'principals/system/system',
|
'uri' => 'principals/system/system',
|
||||||
|
@ -103,7 +103,7 @@ class SystemPrincipalBackend extends AbstractBackend {
|
||||||
* @param \Sabre\DAV\PropPatch $propPatch
|
* @param \Sabre\DAV\PropPatch $propPatch
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function updatePrincipal($path, \Sabre\DAV\PropPatch $propPatch) {
|
public function updatePrincipal($path, \Sabre\DAV\PropPatch $propPatch) {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -135,7 +135,7 @@ class SystemPrincipalBackend extends AbstractBackend {
|
||||||
* @param string $test
|
* @param string $test
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function searchPrincipals($prefixPath, array $searchProperties, $test = 'allof') {
|
public function searchPrincipals($prefixPath, array $searchProperties, $test = 'allof') {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ class SystemPrincipalBackend extends AbstractBackend {
|
||||||
* @param string $principal
|
* @param string $principal
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getGroupMemberSet($principal) {
|
public function getGroupMemberSet($principal) {
|
||||||
// TODO: for now the group principal has only one member, the user itself
|
// TODO: for now the group principal has only one member, the user itself
|
||||||
$principal = $this->getPrincipalByPath($principal);
|
$principal = $this->getPrincipalByPath($principal);
|
||||||
if (!$principal) {
|
if (!$principal) {
|
||||||
|
@ -161,7 +161,7 @@ class SystemPrincipalBackend extends AbstractBackend {
|
||||||
* @param string $principal
|
* @param string $principal
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getGroupMembership($principal) {
|
public function getGroupMembership($principal) {
|
||||||
list($prefix, ) = \Sabre\Uri\split($principal);
|
list($prefix, ) = \Sabre\Uri\split($principal);
|
||||||
|
|
||||||
if ($prefix === 'principals/system') {
|
if ($prefix === 'principals/system') {
|
||||||
|
@ -184,7 +184,7 @@ class SystemPrincipalBackend extends AbstractBackend {
|
||||||
* @param array $members
|
* @param array $members
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function setGroupMemberSet($principal, array $members) {
|
public function setGroupMemberSet($principal, array $members) {
|
||||||
throw new \Sabre\DAV\Exception('Setting members of the group is not supported yet');
|
throw new \Sabre\DAV\Exception('Setting members of the group is not supported yet');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ class BrowserErrorPagePlugin extends ServerPlugin {
|
||||||
* @param Server $server
|
* @param Server $server
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function initialize(Server $server) {
|
public function initialize(Server $server) {
|
||||||
$this->server = $server;
|
$this->server = $server;
|
||||||
$server->on('exception', [$this, 'logException'], 1000);
|
$server->on('exception', [$this, 'logException'], 1000);
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,16 +49,16 @@ class FilesHome extends Directory {
|
||||||
parent::__construct($view, $userFolder);
|
parent::__construct($view, $userFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
function delete() {
|
public function delete() {
|
||||||
throw new Forbidden('Permission denied to delete home folder');
|
throw new Forbidden('Permission denied to delete home folder');
|
||||||
}
|
}
|
||||||
|
|
||||||
function getName() {
|
public function getName() {
|
||||||
list(,$name) = \Sabre\Uri\split($this->principalInfo['uri']);
|
list(,$name) = \Sabre\Uri\split($this->principalInfo['uri']);
|
||||||
return $name;
|
return $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setName($name) {
|
public function setName($name) {
|
||||||
throw new Forbidden('Permission denied to rename this folder');
|
throw new Forbidden('Permission denied to rename this folder');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ class RootCollection extends AbstractPrincipalCollection {
|
||||||
* @param array $principalInfo
|
* @param array $principalInfo
|
||||||
* @return INode
|
* @return INode
|
||||||
*/
|
*/
|
||||||
function getChildForPrincipal(array $principalInfo) {
|
public function getChildForPrincipal(array $principalInfo) {
|
||||||
list(,$name) = \Sabre\Uri\split($principalInfo['uri']);
|
list(,$name) = \Sabre\Uri\split($principalInfo['uri']);
|
||||||
$user = \OC::$server->getUserSession()->getUser();
|
$user = \OC::$server->getUserSession()->getUser();
|
||||||
if (is_null($user) || $name !== $user->getUID()) {
|
if (is_null($user) || $name !== $user->getUID()) {
|
||||||
|
@ -58,7 +58,7 @@ class RootCollection extends AbstractPrincipalCollection {
|
||||||
return new FilesHome($principalInfo, $userFolder);
|
return new FilesHome($principalInfo, $userFolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getName() {
|
public function getName() {
|
||||||
return 'files';
|
return 'files';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,21 +86,21 @@ class SystemTagsByIdCollection implements ICollection {
|
||||||
* @param resource|string $data Initial payload
|
* @param resource|string $data Initial payload
|
||||||
* @throws Forbidden
|
* @throws Forbidden
|
||||||
*/
|
*/
|
||||||
function createFile($name, $data = null) {
|
public function createFile($name, $data = null) {
|
||||||
throw new Forbidden('Cannot create tags by id');
|
throw new Forbidden('Cannot create tags by id');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $name
|
* @param string $name
|
||||||
*/
|
*/
|
||||||
function createDirectory($name) {
|
public function createDirectory($name) {
|
||||||
throw new Forbidden('Permission denied to create collections');
|
throw new Forbidden('Permission denied to create collections');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $name
|
* @param string $name
|
||||||
*/
|
*/
|
||||||
function getChild($name) {
|
public function getChild($name) {
|
||||||
try {
|
try {
|
||||||
$tag = $this->tagManager->getTagsByIds([$name]);
|
$tag = $this->tagManager->getTagsByIds([$name]);
|
||||||
$tag = current($tag);
|
$tag = current($tag);
|
||||||
|
@ -115,7 +115,7 @@ class SystemTagsByIdCollection implements ICollection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getChildren() {
|
public function getChildren() {
|
||||||
$visibilityFilter = true;
|
$visibilityFilter = true;
|
||||||
if ($this->isAdmin()) {
|
if ($this->isAdmin()) {
|
||||||
$visibilityFilter = null;
|
$visibilityFilter = null;
|
||||||
|
@ -130,7 +130,7 @@ class SystemTagsByIdCollection implements ICollection {
|
||||||
/**
|
/**
|
||||||
* @param string $name
|
* @param string $name
|
||||||
*/
|
*/
|
||||||
function childExists($name) {
|
public function childExists($name) {
|
||||||
try {
|
try {
|
||||||
$tag = $this->tagManager->getTagsByIds([$name]);
|
$tag = $this->tagManager->getTagsByIds([$name]);
|
||||||
$tag = current($tag);
|
$tag = current($tag);
|
||||||
|
@ -145,15 +145,15 @@ class SystemTagsByIdCollection implements ICollection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function delete() {
|
public function delete() {
|
||||||
throw new Forbidden('Permission denied to delete this collection');
|
throw new Forbidden('Permission denied to delete this collection');
|
||||||
}
|
}
|
||||||
|
|
||||||
function getName() {
|
public function getName() {
|
||||||
return 'systemtags';
|
return 'systemtags';
|
||||||
}
|
}
|
||||||
|
|
||||||
function setName($name) {
|
public function setName($name) {
|
||||||
throw new Forbidden('Permission denied to rename this collection');
|
throw new Forbidden('Permission denied to rename this collection');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ class SystemTagsByIdCollection implements ICollection {
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function getLastModified() {
|
public function getLastModified() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ class SystemTagsObjectMappingCollection implements ICollection {
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createFile($tagId, $data = null) {
|
public function createFile($tagId, $data = null) {
|
||||||
try {
|
try {
|
||||||
$tags = $this->tagManager->getTagsByIds([$tagId]);
|
$tags = $this->tagManager->getTagsByIds([$tagId]);
|
||||||
$tag = current($tags);
|
$tag = current($tags);
|
||||||
|
@ -109,11 +109,11 @@ class SystemTagsObjectMappingCollection implements ICollection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function createDirectory($name) {
|
public function createDirectory($name) {
|
||||||
throw new Forbidden('Permission denied to create collections');
|
throw new Forbidden('Permission denied to create collections');
|
||||||
}
|
}
|
||||||
|
|
||||||
function getChild($tagId) {
|
public function getChild($tagId) {
|
||||||
try {
|
try {
|
||||||
if ($this->tagMapper->haveTag([$this->objectId], $this->objectType, $tagId, true)) {
|
if ($this->tagMapper->haveTag([$this->objectId], $this->objectType, $tagId, true)) {
|
||||||
$tag = $this->tagManager->getTagsByIds([$tagId]);
|
$tag = $this->tagManager->getTagsByIds([$tagId]);
|
||||||
|
@ -130,7 +130,7 @@ class SystemTagsObjectMappingCollection implements ICollection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getChildren() {
|
public function getChildren() {
|
||||||
$tagIds = current($this->tagMapper->getTagIdsForObjects([$this->objectId], $this->objectType));
|
$tagIds = current($this->tagMapper->getTagIdsForObjects([$this->objectId], $this->objectType));
|
||||||
if (empty($tagIds)) {
|
if (empty($tagIds)) {
|
||||||
return [];
|
return [];
|
||||||
|
@ -147,7 +147,7 @@ class SystemTagsObjectMappingCollection implements ICollection {
|
||||||
}, $tags));
|
}, $tags));
|
||||||
}
|
}
|
||||||
|
|
||||||
function childExists($tagId) {
|
public function childExists($tagId) {
|
||||||
try {
|
try {
|
||||||
$result = $this->tagMapper->haveTag([$this->objectId], $this->objectType, $tagId, true);
|
$result = $this->tagMapper->haveTag([$this->objectId], $this->objectType, $tagId, true);
|
||||||
|
|
||||||
|
@ -167,15 +167,15 @@ class SystemTagsObjectMappingCollection implements ICollection {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function delete() {
|
public function delete() {
|
||||||
throw new Forbidden('Permission denied to delete this collection');
|
throw new Forbidden('Permission denied to delete this collection');
|
||||||
}
|
}
|
||||||
|
|
||||||
function getName() {
|
public function getName() {
|
||||||
return $this->objectId;
|
return $this->objectId;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setName($name) {
|
public function setName($name) {
|
||||||
throw new Forbidden('Permission denied to rename this collection');
|
throw new Forbidden('Permission denied to rename this collection');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ class SystemTagsObjectMappingCollection implements ICollection {
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function getLastModified() {
|
public function getLastModified() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ class SystemTagsObjectTypeCollection implements ICollection {
|
||||||
* @return null|string
|
* @return null|string
|
||||||
* @throws Forbidden
|
* @throws Forbidden
|
||||||
*/
|
*/
|
||||||
function createFile($name, $data = null) {
|
public function createFile($name, $data = null) {
|
||||||
throw new Forbidden('Permission denied to create nodes');
|
throw new Forbidden('Permission denied to create nodes');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +109,7 @@ class SystemTagsObjectTypeCollection implements ICollection {
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @throws Forbidden
|
* @throws Forbidden
|
||||||
*/
|
*/
|
||||||
function createDirectory($name) {
|
public function createDirectory($name) {
|
||||||
throw new Forbidden('Permission denied to create collections');
|
throw new Forbidden('Permission denied to create collections');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ class SystemTagsObjectTypeCollection implements ICollection {
|
||||||
* @return SystemTagsObjectMappingCollection
|
* @return SystemTagsObjectMappingCollection
|
||||||
* @throws NotFound
|
* @throws NotFound
|
||||||
*/
|
*/
|
||||||
function getChild($objectId) {
|
public function getChild($objectId) {
|
||||||
// make sure the object exists and is reachable
|
// make sure the object exists and is reachable
|
||||||
if (!$this->childExists($objectId)) {
|
if (!$this->childExists($objectId)) {
|
||||||
throw new NotFound('Entity does not exist or is not available');
|
throw new NotFound('Entity does not exist or is not available');
|
||||||
|
@ -132,7 +132,7 @@ class SystemTagsObjectTypeCollection implements ICollection {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getChildren() {
|
public function getChildren() {
|
||||||
// do not list object ids
|
// do not list object ids
|
||||||
throw new MethodNotAllowed();
|
throw new MethodNotAllowed();
|
||||||
}
|
}
|
||||||
|
@ -143,15 +143,15 @@ class SystemTagsObjectTypeCollection implements ICollection {
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function childExists($name) {
|
public function childExists($name) {
|
||||||
return call_user_func($this->childExistsFunction, $name);
|
return call_user_func($this->childExistsFunction, $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
function delete() {
|
public function delete() {
|
||||||
throw new Forbidden('Permission denied to delete this collection');
|
throw new Forbidden('Permission denied to delete this collection');
|
||||||
}
|
}
|
||||||
|
|
||||||
function getName() {
|
public function getName() {
|
||||||
return $this->objectType;
|
return $this->objectType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ class SystemTagsObjectTypeCollection implements ICollection {
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @throws Forbidden
|
* @throws Forbidden
|
||||||
*/
|
*/
|
||||||
function setName($name) {
|
public function setName($name) {
|
||||||
throw new Forbidden('Permission denied to rename this collection');
|
throw new Forbidden('Permission denied to rename this collection');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,7 +168,7 @@ class SystemTagsObjectTypeCollection implements ICollection {
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function getLastModified() {
|
public function getLastModified() {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,11 +84,11 @@ class SystemTagsRelationsCollection extends SimpleCollection {
|
||||||
parent::__construct('root', $children);
|
parent::__construct('root', $children);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getName() {
|
public function getName() {
|
||||||
return 'systemtags-relations';
|
return 'systemtags-relations';
|
||||||
}
|
}
|
||||||
|
|
||||||
function setName($name) {
|
public function setName($name) {
|
||||||
throw new Forbidden('Permission denied to rename this collection');
|
throw new Forbidden('Permission denied to rename this collection');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ class ChunkingPlugin extends ServerPlugin {
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
function initialize(Server $server) {
|
public function initialize(Server $server) {
|
||||||
$server->on('beforeMove', [$this, 'beforeMove']);
|
$server->on('beforeMove', [$this, 'beforeMove']);
|
||||||
$this->server = $server;
|
$this->server = $server;
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ class ChunkingPlugin extends ServerPlugin {
|
||||||
* @param string $sourcePath source path
|
* @param string $sourcePath source path
|
||||||
* @param string $destination destination path
|
* @param string $destination destination path
|
||||||
*/
|
*/
|
||||||
function beforeMove($sourcePath, $destination) {
|
public function beforeMove($sourcePath, $destination) {
|
||||||
$this->sourceNode = $this->server->tree->getNodeForPath($sourcePath);
|
$this->sourceNode = $this->server->tree->getNodeForPath($sourcePath);
|
||||||
if (!$this->sourceNode instanceof FutureFile) {
|
if (!$this->sourceNode instanceof FutureFile) {
|
||||||
// skip handling as the source is not a chunked FutureFile
|
// skip handling as the source is not a chunked FutureFile
|
||||||
|
|
|
@ -47,7 +47,7 @@ class FutureFile implements \Sabre\DAV\IFile {
|
||||||
* @param Directory $root
|
* @param Directory $root
|
||||||
* @param string $name
|
* @param string $name
|
||||||
*/
|
*/
|
||||||
function __construct(Directory $root, $name) {
|
public function __construct(Directory $root, $name) {
|
||||||
$this->root = $root;
|
$this->root = $root;
|
||||||
$this->name = $name;
|
$this->name = $name;
|
||||||
}
|
}
|
||||||
|
@ -55,14 +55,14 @@ class FutureFile implements \Sabre\DAV\IFile {
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
function put($data) {
|
public function put($data) {
|
||||||
throw new Forbidden('Permission denied to put into this file');
|
throw new Forbidden('Permission denied to put into this file');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
function get() {
|
public function get() {
|
||||||
$nodes = $this->root->getChildren();
|
$nodes = $this->root->getChildren();
|
||||||
return AssemblyStream::wrap($nodes);
|
return AssemblyStream::wrap($nodes);
|
||||||
}
|
}
|
||||||
|
@ -70,21 +70,21 @@ class FutureFile implements \Sabre\DAV\IFile {
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
function getContentType() {
|
public function getContentType() {
|
||||||
return 'application/octet-stream';
|
return 'application/octet-stream';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
function getETag() {
|
public function getETag() {
|
||||||
return $this->root->getETag();
|
return $this->root->getETag();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
function getSize() {
|
public function getSize() {
|
||||||
$children = $this->root->getChildren();
|
$children = $this->root->getChildren();
|
||||||
$sizes = array_map(function ($node) {
|
$sizes = array_map(function ($node) {
|
||||||
/** @var IFile $node */
|
/** @var IFile $node */
|
||||||
|
@ -97,28 +97,28 @@ class FutureFile implements \Sabre\DAV\IFile {
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
function delete() {
|
public function delete() {
|
||||||
$this->root->delete();
|
$this->root->delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
function getName() {
|
public function getName() {
|
||||||
return $this->name;
|
return $this->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
function setName($name) {
|
public function setName($name) {
|
||||||
throw new Forbidden('Permission denied to rename this file');
|
throw new Forbidden('Permission denied to rename this file');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritdoc
|
* @inheritdoc
|
||||||
*/
|
*/
|
||||||
function getLastModified() {
|
public function getLastModified() {
|
||||||
return $this->root->getLastModified();
|
return $this->root->getLastModified();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,56 +35,56 @@ class UploadFolder implements ICollection {
|
||||||
/** @var CleanupService */
|
/** @var CleanupService */
|
||||||
private $cleanupService;
|
private $cleanupService;
|
||||||
|
|
||||||
function __construct(Directory $node, CleanupService $cleanupService) {
|
public function __construct(Directory $node, CleanupService $cleanupService) {
|
||||||
$this->node = $node;
|
$this->node = $node;
|
||||||
$this->cleanupService = $cleanupService;
|
$this->cleanupService = $cleanupService;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createFile($name, $data = null) {
|
public function createFile($name, $data = null) {
|
||||||
// TODO: verify name - should be a simple number
|
// TODO: verify name - should be a simple number
|
||||||
$this->node->createFile($name, $data);
|
$this->node->createFile($name, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function createDirectory($name) {
|
public function createDirectory($name) {
|
||||||
throw new Forbidden('Permission denied to create file (filename ' . $name . ')');
|
throw new Forbidden('Permission denied to create file (filename ' . $name . ')');
|
||||||
}
|
}
|
||||||
|
|
||||||
function getChild($name) {
|
public function getChild($name) {
|
||||||
if ($name === '.file') {
|
if ($name === '.file') {
|
||||||
return new FutureFile($this->node, '.file');
|
return new FutureFile($this->node, '.file');
|
||||||
}
|
}
|
||||||
return $this->node->getChild($name);
|
return $this->node->getChild($name);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getChildren() {
|
public function getChildren() {
|
||||||
$children = $this->node->getChildren();
|
$children = $this->node->getChildren();
|
||||||
$children[] = new FutureFile($this->node, '.file');
|
$children[] = new FutureFile($this->node, '.file');
|
||||||
return $children;
|
return $children;
|
||||||
}
|
}
|
||||||
|
|
||||||
function childExists($name) {
|
public function childExists($name) {
|
||||||
if ($name === '.file') {
|
if ($name === '.file') {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return $this->node->childExists($name);
|
return $this->node->childExists($name);
|
||||||
}
|
}
|
||||||
|
|
||||||
function delete() {
|
public function delete() {
|
||||||
$this->node->delete();
|
$this->node->delete();
|
||||||
|
|
||||||
// Background cleanup job is not needed anymore
|
// Background cleanup job is not needed anymore
|
||||||
$this->cleanupService->removeJob($this->getName());
|
$this->cleanupService->removeJob($this->getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
function getName() {
|
public function getName() {
|
||||||
return $this->node->getName();
|
return $this->node->getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
function setName($name) {
|
public function setName($name) {
|
||||||
throw new Forbidden('Permission denied to rename this folder');
|
throw new Forbidden('Permission denied to rename this folder');
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLastModified() {
|
public function getLastModified() {
|
||||||
return $this->node->getLastModified();
|
return $this->node->getLastModified();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -198,7 +198,7 @@ class ObjectTreeTest extends \Test\TestCase {
|
||||||
unset($_SERVER['HTTP_OC_CHUNKED']);
|
unset($_SERVER['HTTP_OC_CHUNKED']);
|
||||||
}
|
}
|
||||||
|
|
||||||
function nodeForPathProvider() {
|
public function nodeForPathProvider() {
|
||||||
return [
|
return [
|
||||||
// regular file
|
// regular file
|
||||||
[
|
[
|
||||||
|
|
|
@ -78,7 +78,7 @@ class Auth implements BackendInterface {
|
||||||
* @param ResponseInterface $response
|
* @param ResponseInterface $response
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function check(RequestInterface $request, ResponseInterface $response) {
|
public function check(RequestInterface $request, ResponseInterface $response) {
|
||||||
$userSession = \OC::$server->getUserSession();
|
$userSession = \OC::$server->getUserSession();
|
||||||
$result = $userSession->login($this->user, $this->password);
|
$result = $userSession->login($this->user, $this->password);
|
||||||
if ($result) {
|
if ($result) {
|
||||||
|
@ -113,7 +113,7 @@ class Auth implements BackendInterface {
|
||||||
* @param ResponseInterface $response
|
* @param ResponseInterface $response
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function challenge(RequestInterface $request, ResponseInterface $response) {
|
public function challenge(RequestInterface $request, ResponseInterface $response) {
|
||||||
// TODO: Implement challenge() method.
|
// TODO: Implement challenge() method.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -267,7 +267,7 @@ class SharesPluginTest extends \Test\TestCase {
|
||||||
$this->assertEquals($shareTypes, $result[200][self::SHARETYPES_PROPERTYNAME]->getShareTypes());
|
$this->assertEquals($shareTypes, $result[200][self::SHARETYPES_PROPERTYNAME]->getShareTypes());
|
||||||
}
|
}
|
||||||
|
|
||||||
function sharesGetPropertiesDataProvider() {
|
public function sharesGetPropertiesDataProvider() {
|
||||||
return [
|
return [
|
||||||
[[]],
|
[[]],
|
||||||
[[\OCP\Share::SHARE_TYPE_USER]],
|
[[\OCP\Share::SHARE_TYPE_USER]],
|
||||||
|
|
|
@ -211,7 +211,7 @@ class TagsPluginTest extends \Test\TestCase {
|
||||||
$this->assertEquals($expectedProperties, $result);
|
$this->assertEquals($expectedProperties, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
function tagsGetPropertiesDataProvider() {
|
public function tagsGetPropertiesDataProvider() {
|
||||||
return [
|
return [
|
||||||
// request both, receive both
|
// request both, receive both
|
||||||
[
|
[
|
||||||
|
|
|
@ -87,6 +87,6 @@ class SapiMock extends Sapi {
|
||||||
*
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
static function sendResponse(ResponseInterface $response) {
|
public static function sendResponse(ResponseInterface $response) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,7 @@ class AssemblyStreamTest extends \Test\TestCase {
|
||||||
$this->assertEquals(substr($expected, $offset), $content);
|
$this->assertEquals(substr($expected, $offset), $content);
|
||||||
}
|
}
|
||||||
|
|
||||||
function providesNodes() {
|
public function providesNodes() {
|
||||||
$data8k = $this->makeData(8192);
|
$data8k = $this->makeData(8192);
|
||||||
$dataLess8k = $this->makeData(8191);
|
$dataLess8k = $this->makeData(8191);
|
||||||
|
|
||||||
|
|
|
@ -245,7 +245,7 @@ class SettingsControllerTest extends TestCase {
|
||||||
$data['message']);
|
$data['message']);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testSetEncryptHomeStorage() {
|
public function testSetEncryptHomeStorage() {
|
||||||
$value = true;
|
$value = true;
|
||||||
$this->utilMock->expects($this->once())->method('setEncryptHomeStorage')->with($value);
|
$this->utilMock->expects($this->once())->method('setEncryptHomeStorage')->with($value);
|
||||||
$this->controller->setEncryptHomeStorage($value);
|
$this->controller->setEncryptHomeStorage($value);
|
||||||
|
|
|
@ -144,7 +144,7 @@ class RequestHandlerControllerTest extends \Test\TestCase {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testCreateShare() {
|
public function testCreateShare() {
|
||||||
// simulate a post request
|
// simulate a post request
|
||||||
$_POST['remote'] = 'localhost';
|
$_POST['remote'] = 'localhost';
|
||||||
$_POST['token'] = 'token';
|
$_POST['token'] = 'token';
|
||||||
|
@ -185,7 +185,7 @@ class RequestHandlerControllerTest extends \Test\TestCase {
|
||||||
$this->assertInstanceOf(DataResponse::class, $result);
|
$this->assertInstanceOf(DataResponse::class, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testDeclineShare() {
|
public function testDeclineShare() {
|
||||||
$id = 42;
|
$id = 42;
|
||||||
$_POST['token'] = 'token';
|
$_POST['token'] = 'token';
|
||||||
|
|
||||||
|
@ -209,7 +209,7 @@ class RequestHandlerControllerTest extends \Test\TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function testAcceptShare() {
|
public function testAcceptShare() {
|
||||||
$id = 42;
|
$id = 42;
|
||||||
$_POST['token'] = 'token';
|
$_POST['token'] = 'token';
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ class HelperTest extends \Test\TestCase {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
function sortDataProvider() {
|
public function sortDataProvider() {
|
||||||
return [
|
return [
|
||||||
[
|
[
|
||||||
'name',
|
'name',
|
||||||
|
|
|
@ -51,7 +51,7 @@ class Applicable extends Base {
|
||||||
*/
|
*/
|
||||||
private $groupManager;
|
private $groupManager;
|
||||||
|
|
||||||
function __construct(
|
public function __construct(
|
||||||
GlobalStoragesService $globalService,
|
GlobalStoragesService $globalService,
|
||||||
IUserManager $userManager,
|
IUserManager $userManager,
|
||||||
IGroupManager $groupManager
|
IGroupManager $groupManager
|
||||||
|
|
|
@ -35,7 +35,7 @@ class Backends extends Base {
|
||||||
/** @var BackendService */
|
/** @var BackendService */
|
||||||
private $backendService;
|
private $backendService;
|
||||||
|
|
||||||
function __construct(BackendService $backendService
|
public function __construct(BackendService $backendService
|
||||||
) {
|
) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ class Config extends Base {
|
||||||
*/
|
*/
|
||||||
protected $globalService;
|
protected $globalService;
|
||||||
|
|
||||||
function __construct(GlobalStoragesService $globalService) {
|
public function __construct(GlobalStoragesService $globalService) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->globalService = $globalService;
|
$this->globalService = $globalService;
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ class Create extends Base {
|
||||||
/** @var IUserSession */
|
/** @var IUserSession */
|
||||||
private $userSession;
|
private $userSession;
|
||||||
|
|
||||||
function __construct(GlobalStoragesService $globalService,
|
public function __construct(GlobalStoragesService $globalService,
|
||||||
UserStoragesService $userService,
|
UserStoragesService $userService,
|
||||||
IUserManager $userManager,
|
IUserManager $userManager,
|
||||||
IUserSession $userSession,
|
IUserSession $userSession,
|
||||||
|
|
|
@ -58,7 +58,7 @@ class Delete extends Base {
|
||||||
*/
|
*/
|
||||||
protected $userManager;
|
protected $userManager;
|
||||||
|
|
||||||
function __construct(GlobalStoragesService $globalService, UserStoragesService $userService, IUserSession $userSession, IUserManager $userManager) {
|
public function __construct(GlobalStoragesService $globalService, UserStoragesService $userService, IUserSession $userSession, IUserManager $userManager) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->globalService = $globalService;
|
$this->globalService = $globalService;
|
||||||
$this->userService = $userService;
|
$this->userService = $userService;
|
||||||
|
|
|
@ -66,7 +66,7 @@ class Import extends Base {
|
||||||
/** @var BackendService */
|
/** @var BackendService */
|
||||||
private $backendService;
|
private $backendService;
|
||||||
|
|
||||||
function __construct(GlobalStoragesService $globalService,
|
public function __construct(GlobalStoragesService $globalService,
|
||||||
UserStoragesService $userService,
|
UserStoragesService $userService,
|
||||||
IUserSession $userSession,
|
IUserSession $userSession,
|
||||||
IUserManager $userManager,
|
IUserManager $userManager,
|
||||||
|
|
|
@ -60,7 +60,7 @@ class ListCommand extends Base {
|
||||||
|
|
||||||
const ALL = -1;
|
const ALL = -1;
|
||||||
|
|
||||||
function __construct(GlobalStoragesService $globalService, UserStoragesService $userService, IUserSession $userSession, IUserManager $userManager) {
|
public function __construct(GlobalStoragesService $globalService, UserStoragesService $userService, IUserSession $userSession, IUserManager $userManager) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->globalService = $globalService;
|
$this->globalService = $globalService;
|
||||||
$this->userService = $userService;
|
$this->userService = $userService;
|
||||||
|
|
|
@ -52,7 +52,7 @@ class Notify extends Base {
|
||||||
/** @var ILogger */
|
/** @var ILogger */
|
||||||
private $logger;
|
private $logger;
|
||||||
|
|
||||||
function __construct(GlobalStoragesService $globalService, IDBConnection $connection, ILogger $logger) {
|
public function __construct(GlobalStoragesService $globalService, IDBConnection $connection, ILogger $logger) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->globalService = $globalService;
|
$this->globalService = $globalService;
|
||||||
$this->connection = $connection;
|
$this->connection = $connection;
|
||||||
|
|
|
@ -42,7 +42,7 @@ class Verify extends Base {
|
||||||
*/
|
*/
|
||||||
protected $globalService;
|
protected $globalService;
|
||||||
|
|
||||||
function __construct(GlobalStoragesService $globalService) {
|
public function __construct(GlobalStoragesService $globalService) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->globalService = $globalService;
|
$this->globalService = $globalService;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ class InvalidBackend extends Backend {
|
||||||
*
|
*
|
||||||
* @param string $invalidId id of the backend that did not exist
|
* @param string $invalidId id of the backend that did not exist
|
||||||
*/
|
*/
|
||||||
function __construct($invalidId) {
|
public function __construct($invalidId) {
|
||||||
$this->invalidId = $invalidId;
|
$this->invalidId = $invalidId;
|
||||||
$this
|
$this
|
||||||
->setIdentifier($invalidId)
|
->setIdentifier($invalidId)
|
||||||
|
|
|
@ -50,7 +50,7 @@ class SFTPReadStream implements File {
|
||||||
|
|
||||||
private $buffer = '';
|
private $buffer = '';
|
||||||
|
|
||||||
static function register($protocol = 'sftpread') {
|
public static function register($protocol = 'sftpread') {
|
||||||
if (in_array($protocol, stream_get_wrappers(), true)) {
|
if (in_array($protocol, stream_get_wrappers(), true)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ class SFTPWriteStream implements File {
|
||||||
|
|
||||||
private $buffer = '';
|
private $buffer = '';
|
||||||
|
|
||||||
static function register($protocol = 'sftpwrite') {
|
public static function register($protocol = 'sftpwrite') {
|
||||||
if (in_array($protocol, stream_get_wrappers(), true)) {
|
if (in_array($protocol, stream_get_wrappers(), true)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,7 +173,7 @@ abstract class StoragesControllerTest extends \Test\TestCase {
|
||||||
$this->assertEquals($storageConfig, $data);
|
$this->assertEquals($storageConfig, $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
function mountPointNamesProvider() {
|
public function mountPointNamesProvider() {
|
||||||
return [
|
return [
|
||||||
[''],
|
[''],
|
||||||
['/'],
|
['/'],
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace OCA\Files_External\Tests;
|
||||||
* @package OCA\Files_External\Tests
|
* @package OCA\Files_External\Tests
|
||||||
*/
|
*/
|
||||||
class OwnCloudFunctionsTest extends \Test\TestCase {
|
class OwnCloudFunctionsTest extends \Test\TestCase {
|
||||||
function configUrlProvider() {
|
public function configUrlProvider() {
|
||||||
return [
|
return [
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
|
|
|
@ -63,7 +63,7 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
function storageDataProvider() {
|
public function storageDataProvider() {
|
||||||
return [
|
return [
|
||||||
// all users
|
// all users
|
||||||
[
|
[
|
||||||
|
@ -191,7 +191,7 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
|
||||||
$this->assertEquals(0, $newStorage->getStatus());
|
$this->assertEquals(0, $newStorage->getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
function hooksAddStorageDataProvider() {
|
public function hooksAddStorageDataProvider() {
|
||||||
return [
|
return [
|
||||||
// applicable all
|
// applicable all
|
||||||
[
|
[
|
||||||
|
@ -320,7 +320,7 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function hooksUpdateStorageDataProvider() {
|
public function hooksUpdateStorageDataProvider() {
|
||||||
return [
|
return [
|
||||||
[
|
[
|
||||||
// nothing to multiple users and groups
|
// nothing to multiple users and groups
|
||||||
|
@ -551,7 +551,7 @@ class GlobalStoragesServiceTest extends StoragesServiceTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function hooksDeleteStorageDataProvider() {
|
public function hooksDeleteStorageDataProvider() {
|
||||||
return [
|
return [
|
||||||
[
|
[
|
||||||
['user1', 'user2'],
|
['user1', 'user2'],
|
||||||
|
|
|
@ -31,7 +31,7 @@ class Updater {
|
||||||
/**
|
/**
|
||||||
* @param array $params
|
* @param array $params
|
||||||
*/
|
*/
|
||||||
static public function renameHook($params) {
|
public static function renameHook($params) {
|
||||||
self::renameChildren($params['oldpath'], $params['newpath']);
|
self::renameChildren($params['oldpath'], $params['newpath']);
|
||||||
self::moveShareToShare($params['newpath']);
|
self::moveShareToShare($params['newpath']);
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ class Updater {
|
||||||
*
|
*
|
||||||
* @param string $path
|
* @param string $path
|
||||||
*/
|
*/
|
||||||
static private function moveShareToShare($path) {
|
private static function moveShareToShare($path) {
|
||||||
$userFolder = \OC::$server->getUserFolder();
|
$userFolder = \OC::$server->getUserFolder();
|
||||||
|
|
||||||
// If the user folder can't be constructed (e.g. link share) just return.
|
// If the user folder can't be constructed (e.g. link share) just return.
|
||||||
|
@ -90,7 +90,7 @@ class Updater {
|
||||||
* @param string $oldPath old path relative to data/user/files
|
* @param string $oldPath old path relative to data/user/files
|
||||||
* @param string $newPath new path relative to data/user/files
|
* @param string $newPath new path relative to data/user/files
|
||||||
*/
|
*/
|
||||||
static private function renameChildren($oldPath, $newPath) {
|
private static function renameChildren($oldPath, $newPath) {
|
||||||
$absNewPath = \OC\Files\Filesystem::normalizePath('/' . \OCP\User::getUser() . '/files/' . $newPath);
|
$absNewPath = \OC\Files\Filesystem::normalizePath('/' . \OCP\User::getUser() . '/files/' . $newPath);
|
||||||
$absOldPath = \OC\Files\Filesystem::normalizePath('/' . \OCP\User::getUser() . '/files/' . $oldPath);
|
$absOldPath = \OC\Files\Filesystem::normalizePath('/' . \OCP\User::getUser() . '/files/' . $oldPath);
|
||||||
|
|
||||||
|
|
|
@ -130,7 +130,7 @@ class ApiTest extends TestCase {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testCreateShareUserFile() {
|
public function testCreateShareUserFile() {
|
||||||
$this->setUp(); // for some reasons phpunit refuses to do this for us only for this test
|
$this->setUp(); // for some reasons phpunit refuses to do this for us only for this test
|
||||||
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1);
|
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1);
|
||||||
$result = $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2);
|
$result = $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2);
|
||||||
|
@ -148,7 +148,7 @@ class ApiTest extends TestCase {
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
function testCreateShareUserFolder() {
|
public function testCreateShareUserFolder() {
|
||||||
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1);
|
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1);
|
||||||
$result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2);
|
$result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2);
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
@ -165,7 +165,7 @@ class ApiTest extends TestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function testCreateShareGroupFile() {
|
public function testCreateShareGroupFile() {
|
||||||
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1);
|
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1);
|
||||||
$result = $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_GROUP, self::TEST_FILES_SHARING_API_GROUP1);
|
$result = $ocs->createShare($this->filename, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_GROUP, self::TEST_FILES_SHARING_API_GROUP1);
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
@ -181,7 +181,7 @@ class ApiTest extends TestCase {
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
function testCreateShareGroupFolder() {
|
public function testCreateShareGroupFolder() {
|
||||||
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1);
|
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1);
|
||||||
$result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_GROUP, self::TEST_FILES_SHARING_API_GROUP1);
|
$result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_GROUP, self::TEST_FILES_SHARING_API_GROUP1);
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
@ -245,7 +245,7 @@ class ApiTest extends TestCase {
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
function testEnforceLinkPassword() {
|
public function testEnforceLinkPassword() {
|
||||||
$password = md5(time());
|
$password = md5(time());
|
||||||
$config = \OC::$server->getConfig();
|
$config = \OC::$server->getConfig();
|
||||||
$config->setAppValue('core', 'shareapi_enforce_links_password', 'yes');
|
$config->setAppValue('core', 'shareapi_enforce_links_password', 'yes');
|
||||||
|
@ -299,7 +299,7 @@ class ApiTest extends TestCase {
|
||||||
/**
|
/**
|
||||||
* @medium
|
* @medium
|
||||||
*/
|
*/
|
||||||
function testSharePermissions() {
|
public function testSharePermissions() {
|
||||||
// sharing file to a user should work if shareapi_exclude_groups is set
|
// sharing file to a user should work if shareapi_exclude_groups is set
|
||||||
// to no
|
// to no
|
||||||
\OC::$server->getConfig()->setAppValue('core', 'shareapi_exclude_groups', 'no');
|
\OC::$server->getConfig()->setAppValue('core', 'shareapi_exclude_groups', 'no');
|
||||||
|
@ -350,7 +350,7 @@ class ApiTest extends TestCase {
|
||||||
/**
|
/**
|
||||||
* @medium
|
* @medium
|
||||||
*/
|
*/
|
||||||
function testGetAllShares() {
|
public function testGetAllShares() {
|
||||||
$node = $this->userFolder->get($this->filename);
|
$node = $this->userFolder->get($this->filename);
|
||||||
|
|
||||||
$share = $this->shareManager->newShare();
|
$share = $this->shareManager->newShare();
|
||||||
|
@ -371,7 +371,7 @@ class ApiTest extends TestCase {
|
||||||
$this->shareManager->deleteShare($share);
|
$this->shareManager->deleteShare($share);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testGetAllSharesWithMe() {
|
public function testGetAllSharesWithMe() {
|
||||||
$node1 = $this->userFolder->get($this->filename);
|
$node1 = $this->userFolder->get($this->filename);
|
||||||
$share1 = $this->shareManager->newShare();
|
$share1 = $this->shareManager->newShare();
|
||||||
$share1->setNode($node1)
|
$share1->setNode($node1)
|
||||||
|
@ -407,7 +407,7 @@ class ApiTest extends TestCase {
|
||||||
/**
|
/**
|
||||||
* @medium
|
* @medium
|
||||||
*/
|
*/
|
||||||
function testPublicLinkUrl() {
|
public function testPublicLinkUrl() {
|
||||||
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1);
|
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER1);
|
||||||
$result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK);
|
$result = $ocs->createShare($this->folder, \OCP\Constants::PERMISSION_ALL, \OCP\Share::SHARE_TYPE_LINK);
|
||||||
$ocs->cleanup();
|
$ocs->cleanup();
|
||||||
|
@ -456,7 +456,7 @@ class ApiTest extends TestCase {
|
||||||
* @depends testCreateShareUserFile
|
* @depends testCreateShareUserFile
|
||||||
* @depends testCreateShareLink
|
* @depends testCreateShareLink
|
||||||
*/
|
*/
|
||||||
function testGetShareFromSource() {
|
public function testGetShareFromSource() {
|
||||||
$node = $this->userFolder->get($this->filename);
|
$node = $this->userFolder->get($this->filename);
|
||||||
$share = $this->shareManager->newShare();
|
$share = $this->shareManager->newShare();
|
||||||
$share->setNode($node)
|
$share->setNode($node)
|
||||||
|
@ -489,7 +489,7 @@ class ApiTest extends TestCase {
|
||||||
* @depends testCreateShareUserFile
|
* @depends testCreateShareUserFile
|
||||||
* @depends testCreateShareLink
|
* @depends testCreateShareLink
|
||||||
*/
|
*/
|
||||||
function testGetShareFromSourceWithReshares() {
|
public function testGetShareFromSourceWithReshares() {
|
||||||
$node = $this->userFolder->get($this->filename);
|
$node = $this->userFolder->get($this->filename);
|
||||||
$share1 = $this->shareManager->newShare();
|
$share1 = $this->shareManager->newShare();
|
||||||
$share1->setNode($node)
|
$share1->setNode($node)
|
||||||
|
@ -530,7 +530,7 @@ class ApiTest extends TestCase {
|
||||||
* @medium
|
* @medium
|
||||||
* @depends testCreateShareUserFile
|
* @depends testCreateShareUserFile
|
||||||
*/
|
*/
|
||||||
function testGetShareFromId() {
|
public function testGetShareFromId() {
|
||||||
$node = $this->userFolder->get($this->filename);
|
$node = $this->userFolder->get($this->filename);
|
||||||
$share1 = $this->shareManager->newShare();
|
$share1 = $this->shareManager->newShare();
|
||||||
$share1->setNode($node)
|
$share1->setNode($node)
|
||||||
|
@ -554,7 +554,7 @@ class ApiTest extends TestCase {
|
||||||
/**
|
/**
|
||||||
* @medium
|
* @medium
|
||||||
*/
|
*/
|
||||||
function testGetShareFromFolder() {
|
public function testGetShareFromFolder() {
|
||||||
$node1 = $this->userFolder->get($this->filename);
|
$node1 = $this->userFolder->get($this->filename);
|
||||||
$share1 = $this->shareManager->newShare();
|
$share1 = $this->shareManager->newShare();
|
||||||
$share1->setNode($node1)
|
$share1->setNode($node1)
|
||||||
|
@ -584,7 +584,7 @@ class ApiTest extends TestCase {
|
||||||
$this->shareManager->deleteShare($share2);
|
$this->shareManager->deleteShare($share2);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testGetShareFromFolderWithFile() {
|
public function testGetShareFromFolderWithFile() {
|
||||||
$node1 = $this->userFolder->get($this->filename);
|
$node1 = $this->userFolder->get($this->filename);
|
||||||
$share1 = $this->shareManager->newShare();
|
$share1 = $this->shareManager->newShare();
|
||||||
$share1->setNode($node1)
|
$share1->setNode($node1)
|
||||||
|
@ -610,7 +610,7 @@ class ApiTest extends TestCase {
|
||||||
* share a folder, than reshare a file within the shared folder and check if we construct the correct path
|
* share a folder, than reshare a file within the shared folder and check if we construct the correct path
|
||||||
* @medium
|
* @medium
|
||||||
*/
|
*/
|
||||||
function testGetShareFromFolderReshares() {
|
public function testGetShareFromFolderReshares() {
|
||||||
$node1 = $this->userFolder->get($this->folder);
|
$node1 = $this->userFolder->get($this->folder);
|
||||||
$share1 = $this->shareManager->newShare();
|
$share1 = $this->shareManager->newShare();
|
||||||
$share1->setNode($node1)
|
$share1->setNode($node1)
|
||||||
|
@ -670,7 +670,7 @@ class ApiTest extends TestCase {
|
||||||
* reshare a sub folder and check if we get the correct path
|
* reshare a sub folder and check if we get the correct path
|
||||||
* @medium
|
* @medium
|
||||||
*/
|
*/
|
||||||
function testGetShareFromSubFolderReShares() {
|
public function testGetShareFromSubFolderReShares() {
|
||||||
$node1 = $this->userFolder->get($this->folder . $this->subfolder);
|
$node1 = $this->userFolder->get($this->folder . $this->subfolder);
|
||||||
$share1 = $this->shareManager->newShare();
|
$share1 = $this->shareManager->newShare();
|
||||||
$share1->setNode($node1)
|
$share1->setNode($node1)
|
||||||
|
@ -712,7 +712,7 @@ class ApiTest extends TestCase {
|
||||||
* test re-re-share of folder if the path gets constructed correctly
|
* test re-re-share of folder if the path gets constructed correctly
|
||||||
* @medium
|
* @medium
|
||||||
*/
|
*/
|
||||||
function XtestGetShareFromFolderReReShares() {
|
public function XtestGetShareFromFolderReReShares() {
|
||||||
$node1 = $this->userFolder->get($this->folder . $this->subfolder);
|
$node1 = $this->userFolder->get($this->folder . $this->subfolder);
|
||||||
$share1 = $this->shareManager->newShare();
|
$share1 = $this->shareManager->newShare();
|
||||||
$share1->setNode($node1)
|
$share1->setNode($node1)
|
||||||
|
@ -789,7 +789,7 @@ class ApiTest extends TestCase {
|
||||||
* test multiple shared folder if the path gets constructed correctly
|
* test multiple shared folder if the path gets constructed correctly
|
||||||
* @medium
|
* @medium
|
||||||
*/
|
*/
|
||||||
function testGetShareMultipleSharedFolder() {
|
public function testGetShareMultipleSharedFolder() {
|
||||||
$this->setUp();
|
$this->setUp();
|
||||||
$node1 = $this->userFolder->get($this->folder . $this->subfolder);
|
$node1 = $this->userFolder->get($this->folder . $this->subfolder);
|
||||||
$share1 = $this->shareManager->newShare();
|
$share1 = $this->shareManager->newShare();
|
||||||
|
@ -854,7 +854,7 @@ class ApiTest extends TestCase {
|
||||||
* test re-re-share of folder if the path gets constructed correctly
|
* test re-re-share of folder if the path gets constructed correctly
|
||||||
* @medium
|
* @medium
|
||||||
*/
|
*/
|
||||||
function testGetShareFromFileReReShares() {
|
public function testGetShareFromFileReReShares() {
|
||||||
$node1 = $this->userFolder->get($this->folder . $this->subfolder);
|
$node1 = $this->userFolder->get($this->folder . $this->subfolder);
|
||||||
$share1 = $this->shareManager->newShare();
|
$share1 = $this->shareManager->newShare();
|
||||||
$share1->setNode($node1)
|
$share1->setNode($node1)
|
||||||
|
@ -909,7 +909,7 @@ class ApiTest extends TestCase {
|
||||||
/**
|
/**
|
||||||
* @medium
|
* @medium
|
||||||
*/
|
*/
|
||||||
function testGetShareFromUnknownId() {
|
public function testGetShareFromUnknownId() {
|
||||||
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER3);
|
$ocs = $this->createOCS(self::TEST_FILES_SHARING_API_USER3);
|
||||||
try {
|
try {
|
||||||
$ocs->getShare(0);
|
$ocs->getShare(0);
|
||||||
|
@ -925,7 +925,7 @@ class ApiTest extends TestCase {
|
||||||
* @depends testCreateShareUserFile
|
* @depends testCreateShareUserFile
|
||||||
* @depends testCreateShareLink
|
* @depends testCreateShareLink
|
||||||
*/
|
*/
|
||||||
function testUpdateShare() {
|
public function testUpdateShare() {
|
||||||
$password = md5(time());
|
$password = md5(time());
|
||||||
|
|
||||||
$node1 = $this->userFolder->get($this->filename);
|
$node1 = $this->userFolder->get($this->filename);
|
||||||
|
@ -976,7 +976,7 @@ class ApiTest extends TestCase {
|
||||||
/**
|
/**
|
||||||
* @medium
|
* @medium
|
||||||
*/
|
*/
|
||||||
function testUpdateShareUpload() {
|
public function testUpdateShareUpload() {
|
||||||
$node1 = $this->userFolder->get($this->folder);
|
$node1 = $this->userFolder->get($this->folder);
|
||||||
$share1 = $this->shareManager->newShare();
|
$share1 = $this->shareManager->newShare();
|
||||||
$share1->setNode($node1)
|
$share1->setNode($node1)
|
||||||
|
@ -1006,7 +1006,7 @@ class ApiTest extends TestCase {
|
||||||
/**
|
/**
|
||||||
* @medium
|
* @medium
|
||||||
*/
|
*/
|
||||||
function testUpdateShareExpireDate() {
|
public function testUpdateShareExpireDate() {
|
||||||
$node1 = $this->userFolder->get($this->folder);
|
$node1 = $this->userFolder->get($this->folder);
|
||||||
$share1 = $this->shareManager->newShare();
|
$share1 = $this->shareManager->newShare();
|
||||||
$share1->setNode($node1)
|
$share1->setNode($node1)
|
||||||
|
@ -1078,7 +1078,7 @@ class ApiTest extends TestCase {
|
||||||
* @medium
|
* @medium
|
||||||
* @depends testCreateShareUserFile
|
* @depends testCreateShareUserFile
|
||||||
*/
|
*/
|
||||||
function testDeleteShare() {
|
public function testDeleteShare() {
|
||||||
$node1 = $this->userFolder->get($this->filename);
|
$node1 = $this->userFolder->get($this->filename);
|
||||||
$share1 = $this->shareManager->newShare();
|
$share1 = $this->shareManager->newShare();
|
||||||
$share1->setNode($node1)
|
$share1->setNode($node1)
|
||||||
|
@ -1110,7 +1110,7 @@ class ApiTest extends TestCase {
|
||||||
/**
|
/**
|
||||||
* test unshare of a reshared file
|
* test unshare of a reshared file
|
||||||
*/
|
*/
|
||||||
function testDeleteReshare() {
|
public function testDeleteReshare() {
|
||||||
$node1 = $this->userFolder->get($this->folder);
|
$node1 = $this->userFolder->get($this->folder);
|
||||||
$share1 = $this->shareManager->newShare();
|
$share1 = $this->shareManager->newShare();
|
||||||
$share1->setNode($node1)
|
$share1->setNode($node1)
|
||||||
|
|
|
@ -147,7 +147,7 @@ class CacheTest extends TestCase {
|
||||||
parent::tearDown();
|
parent::tearDown();
|
||||||
}
|
}
|
||||||
|
|
||||||
function searchDataProvider() {
|
public function searchDataProvider() {
|
||||||
return [
|
return [
|
||||||
['%another%',
|
['%another%',
|
||||||
[
|
[
|
||||||
|
@ -211,7 +211,7 @@ class CacheTest extends TestCase {
|
||||||
* we cannot use a dataProvider because that would cause the stray hook detection to remove the hooks
|
* we cannot use a dataProvider because that would cause the stray hook detection to remove the hooks
|
||||||
* that were added in setUpBeforeClass.
|
* that were added in setUpBeforeClass.
|
||||||
*/
|
*/
|
||||||
function testSearch() {
|
public function testSearch() {
|
||||||
foreach ($this->searchDataProvider() as $data) {
|
foreach ($this->searchDataProvider() as $data) {
|
||||||
list($pattern, $expectedFiles) = $data;
|
list($pattern, $expectedFiles) = $data;
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ class CacheTest extends TestCase {
|
||||||
/**
|
/**
|
||||||
* Test searching by mime type
|
* Test searching by mime type
|
||||||
*/
|
*/
|
||||||
function testSearchByMime() {
|
public function testSearchByMime() {
|
||||||
$results = $this->sharedStorage->getCache()->searchByMime('text');
|
$results = $this->sharedStorage->getCache()->searchByMime('text');
|
||||||
$check = [
|
$check = [
|
||||||
[
|
[
|
||||||
|
@ -242,7 +242,7 @@ class CacheTest extends TestCase {
|
||||||
$this->verifyFiles($check, $results);
|
$this->verifyFiles($check, $results);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testGetFolderContentsInRoot() {
|
public function testGetFolderContentsInRoot() {
|
||||||
$results = $this->user2View->getDirectoryContent('/');
|
$results = $this->user2View->getDirectoryContent('/');
|
||||||
|
|
||||||
// we should get the shared items "shareddir" and "shared single file.txt"
|
// we should get the shared items "shareddir" and "shared single file.txt"
|
||||||
|
@ -274,7 +274,7 @@ class CacheTest extends TestCase {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testGetFolderContentsInSubdir() {
|
public function testGetFolderContentsInSubdir() {
|
||||||
$results = $this->user2View->getDirectoryContent('/shareddir');
|
$results = $this->user2View->getDirectoryContent('/shareddir');
|
||||||
|
|
||||||
$this->verifyFiles(
|
$this->verifyFiles(
|
||||||
|
@ -305,7 +305,7 @@ class CacheTest extends TestCase {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testGetFolderContentsWhenSubSubdirShared() {
|
public function testGetFolderContentsWhenSubSubdirShared() {
|
||||||
self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
|
self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
|
||||||
|
|
||||||
$rootFolder = \OC::$server->getUserFolder(self::TEST_FILES_SHARING_API_USER1);
|
$rootFolder = \OC::$server->getUserFolder(self::TEST_FILES_SHARING_API_USER1);
|
||||||
|
|
|
@ -39,7 +39,7 @@ use OCP\Http\Client\IResponse;
|
||||||
* @group DB
|
* @group DB
|
||||||
*/
|
*/
|
||||||
class ExternalStorageTest extends \Test\TestCase {
|
class ExternalStorageTest extends \Test\TestCase {
|
||||||
function optionsProvider() {
|
public function optionsProvider() {
|
||||||
return [
|
return [
|
||||||
[
|
[
|
||||||
'http://remoteserver:8080/owncloud',
|
'http://remoteserver:8080/owncloud',
|
||||||
|
|
|
@ -137,7 +137,7 @@ class PermissionsTest extends TestCase {
|
||||||
/**
|
/**
|
||||||
* Test that the permissions of shared directory are returned correctly
|
* Test that the permissions of shared directory are returned correctly
|
||||||
*/
|
*/
|
||||||
function testGetPermissions() {
|
public function testGetPermissions() {
|
||||||
$sharedDirPerms = $this->sharedStorage->getPermissions('');
|
$sharedDirPerms = $this->sharedStorage->getPermissions('');
|
||||||
$this->assertEquals(31, $sharedDirPerms);
|
$this->assertEquals(31, $sharedDirPerms);
|
||||||
$sharedDirPerms = $this->sharedStorage->getPermissions('textfile.txt');
|
$sharedDirPerms = $this->sharedStorage->getPermissions('textfile.txt');
|
||||||
|
@ -151,7 +151,7 @@ class PermissionsTest extends TestCase {
|
||||||
/**
|
/**
|
||||||
* Test that the permissions of shared directory are returned correctly
|
* Test that the permissions of shared directory are returned correctly
|
||||||
*/
|
*/
|
||||||
function testGetDirectoryPermissions() {
|
public function testGetDirectoryPermissions() {
|
||||||
$contents = $this->secondView->getDirectoryContent('files/shareddir');
|
$contents = $this->secondView->getDirectoryContent('files/shareddir');
|
||||||
$this->assertEquals('subdir', $contents[0]['name']);
|
$this->assertEquals('subdir', $contents[0]['name']);
|
||||||
$this->assertEquals(31, $contents[0]['permissions']);
|
$this->assertEquals(31, $contents[0]['permissions']);
|
||||||
|
|
|
@ -111,7 +111,7 @@ class WatcherTest extends TestCase {
|
||||||
* Tests that writing a file using the shared storage will propagate the file
|
* Tests that writing a file using the shared storage will propagate the file
|
||||||
* size to the owner's parent folders.
|
* size to the owner's parent folders.
|
||||||
*/
|
*/
|
||||||
function testFolderSizePropagationToOwnerStorage() {
|
public function testFolderSizePropagationToOwnerStorage() {
|
||||||
$initialSizes = self::getOwnerDirSizes('files/container/shareddir');
|
$initialSizes = self::getOwnerDirSizes('files/container/shareddir');
|
||||||
|
|
||||||
$textData = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
$textData = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||||
|
@ -141,7 +141,7 @@ class WatcherTest extends TestCase {
|
||||||
* Tests that writing a file using the shared storage will propagate the file
|
* Tests that writing a file using the shared storage will propagate the file
|
||||||
* size to the owner's parent folders.
|
* size to the owner's parent folders.
|
||||||
*/
|
*/
|
||||||
function testSubFolderSizePropagationToOwnerStorage() {
|
public function testSubFolderSizePropagationToOwnerStorage() {
|
||||||
$initialSizes = self::getOwnerDirSizes('files/container/shareddir/subdir');
|
$initialSizes = self::getOwnerDirSizes('files/container/shareddir/subdir');
|
||||||
|
|
||||||
$textData = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
$textData = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||||
|
@ -173,7 +173,7 @@ class WatcherTest extends TestCase {
|
||||||
* where the key is the path and the value is the size.
|
* where the key is the path and the value is the size.
|
||||||
* @param string $path
|
* @param string $path
|
||||||
*/
|
*/
|
||||||
function getOwnerDirSizes($path) {
|
public function getOwnerDirSizes($path) {
|
||||||
$result = [];
|
$result = [];
|
||||||
|
|
||||||
while ($path != '' && $path != '' && $path != '.') {
|
while ($path != '' && $path != '' && $path != '.') {
|
||||||
|
|
|
@ -52,7 +52,7 @@ class CleanUp extends Command {
|
||||||
* @param IUserManager $userManager
|
* @param IUserManager $userManager
|
||||||
* @param IDBConnection $dbConnection
|
* @param IDBConnection $dbConnection
|
||||||
*/
|
*/
|
||||||
function __construct(IRootFolder $rootFolder, IUserManager $userManager, IDBConnection $dbConnection) {
|
public function __construct(IRootFolder $rootFolder, IUserManager $userManager, IDBConnection $dbConnection) {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->userManager = $userManager;
|
$this->userManager = $userManager;
|
||||||
$this->rootFolder = $rootFolder;
|
$this->rootFolder = $rootFolder;
|
||||||
|
|
|
@ -41,7 +41,7 @@ class Expire implements ICommand {
|
||||||
/**
|
/**
|
||||||
* @param string $user
|
* @param string $user
|
||||||
*/
|
*/
|
||||||
function __construct($user) {
|
public function __construct($user) {
|
||||||
$this->user = $user;
|
$this->user = $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ class ExpireTrash extends Command {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function expireTrashForUser(IUser $user) {
|
public function expireTrashForUser(IUser $user) {
|
||||||
$uid = $user->getUID();
|
$uid = $user->getUID();
|
||||||
if (!$this->setupFS($uid)) {
|
if (!$this->setupFS($uid)) {
|
||||||
return;
|
return;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue