summaryrefslogtreecommitdiffstats
path: root/lib/public/Collaboration
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2019-02-11 12:57:38 +0100
committerJulius Härtl <jus@bitgrid.net>2019-03-01 20:56:19 +0100
commit59c92a75139b9db1cc1171f41bac971c2c528873 (patch)
treec897e2fcec33a4c3509539f67198a90c17efc307 /lib/public/Collaboration
parentece471de360ebbebee6b098a20d65042dd69928c (diff)
downloadnextcloud-server-59c92a75139b9db1cc1171f41bac971c2c528873.tar.gz
nextcloud-server-59c92a75139b9db1cc1171f41bac971c2c528873.zip
Further work on the access cache
Searching for all is still a problem Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/public/Collaboration')
-rw-r--r--lib/public/Collaboration/Resources/ICollection.php14
-rw-r--r--lib/public/Collaboration/Resources/IManager.php31
-rw-r--r--lib/public/Collaboration/Resources/IProvider.php4
-rw-r--r--lib/public/Collaboration/Resources/IResource.php4
4 files changed, 41 insertions, 12 deletions
diff --git a/lib/public/Collaboration/Resources/ICollection.php b/lib/public/Collaboration/Resources/ICollection.php
index cd59a7d3e5a..8cdc7b87939 100644
--- a/lib/public/Collaboration/Resources/ICollection.php
+++ b/lib/public/Collaboration/Resources/ICollection.php
@@ -42,6 +42,12 @@ interface ICollection {
public function getName(): string;
/**
+ * @param string $name
+ * @since 16.0.0
+ */
+ public function setName(string $name): void;
+
+ /**
* @return IResource[]
* @since 16.0.0
*/
@@ -54,7 +60,7 @@ interface ICollection {
* @throws ResourceException when the resource is already part of the collection
* @since 16.0.0
*/
- public function addResource(IResource $resource);
+ public function addResource(IResource $resource): void;
/**
* Removes a resource from a collection
@@ -62,14 +68,14 @@ interface ICollection {
* @param IResource $resource
* @since 16.0.0
*/
- public function removeResource(IResource $resource);
+ public function removeResource(IResource $resource): void;
/**
* Can a user/guest access the collection
*
- * @param IUser $user
+ * @param IUser|null $user
* @return bool
* @since 16.0.0
*/
- public function canAccess(IUser $user = null): bool;
+ public function canAccess(?IUser $user): bool;
}
diff --git a/lib/public/Collaboration/Resources/IManager.php b/lib/public/Collaboration/Resources/IManager.php
index 77f958e513a..af371f7b4f0 100644
--- a/lib/public/Collaboration/Resources/IManager.php
+++ b/lib/public/Collaboration/Resources/IManager.php
@@ -22,6 +22,8 @@ declare(strict_types=1);
namespace OCP\Collaboration\Resources;
+use OCP\IUser;
+
/**
* @since 16.0.0
*/
@@ -36,27 +38,48 @@ interface IManager extends IProvider {
public function getCollection(int $id): ICollection;
/**
+ * @param int $id
+ * @param IUser|null $user
+ * @return ICollection
+ * @throws CollectionException when the collection could not be found
+ * @since 16.0.0
+ */
+ public function getCollectionForUser(int $id, ?IUser $user): ICollection;
+
+ /**
* @param string $name
* @return ICollection
* @since 16.0.0
*/
public function newCollection(string $name): ICollection;
+ /**
+ * Can a user/guest access the collection
+ *
+ * @param ICollection $collection
+ * @param IUser|null $user
+ * @return bool
+ * @since 16.0.0
+ */
+ public function canAccessCollection(ICollection $collection, ?IUser $user): bool;
/**
- * @param string $name
- * @return ICollection
+ * @param string $type
+ * @param string $id
+ * @return IResource
* @since 16.0.0
*/
- public function renameCollection(int $id, string $name): ICollection;
+ public function createResource(string $type, string $id): IResource;
/**
* @param string $type
* @param string $id
+ * @param IUser|null $user
* @return IResource
+ * @throws ResourceException
* @since 16.0.0
*/
- public function getResource(string $type, string $id): IResource;
+ public function getResourceForUser(string $type, string $id, ?IUser $user): IResource;
/**
* @param IProvider $provider
diff --git a/lib/public/Collaboration/Resources/IProvider.php b/lib/public/Collaboration/Resources/IProvider.php
index 52ad2305cfe..3014305106f 100644
--- a/lib/public/Collaboration/Resources/IProvider.php
+++ b/lib/public/Collaboration/Resources/IProvider.php
@@ -69,10 +69,10 @@ interface IProvider {
* Can a user/guest access the collection
*
* @param IResource $resource
- * @param IUser $user
+ * @param IUser|null $user
* @return bool
* @since 16.0.0
*/
- public function canAccess(IResource $resource, IUser $user = null): bool;
+ public function canAccessResource(IResource $resource, ?IUser $user): bool;
}
diff --git a/lib/public/Collaboration/Resources/IResource.php b/lib/public/Collaboration/Resources/IResource.php
index 34969dabd0d..609a283c2d8 100644
--- a/lib/public/Collaboration/Resources/IResource.php
+++ b/lib/public/Collaboration/Resources/IResource.php
@@ -62,11 +62,11 @@ interface IResource {
/**
* Can a user/guest access the resource
*
- * @param IUser $user
+ * @param IUser|null $user
* @return bool
* @since 16.0.0
*/
- public function canAccess(IUser $user = null): bool;
+ public function canAccess(?IUser $user): bool;
/**
* @return ICollection[]