summaryrefslogtreecommitdiffstats
path: root/lib/Controller
diff options
context:
space:
mode:
authorMarco Nassabain <marco.nassabain@hotmail.com>2021-02-23 22:59:14 +0100
committerSean Molenaar <SMillerDev@users.noreply.github.com>2021-04-08 22:31:21 +0200
commit907e7647493ee10a6a41d0a8e39b6214ce2752cd (patch)
tree7ab42d6120d7e39f31441bb3adf3ad5de9601002 /lib/Controller
parent237363e087c629f8902828575908d3c54e5aa348 (diff)
🚧 ItemService, Controller: added basic sharing
- TODO: check if relation already exists Signed-off-by: Marco Nassabain <marco.nassabain@hotmail.com>
Diffstat (limited to 'lib/Controller')
-rw-r--r--lib/Controller/ItemController.php17
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/Controller/ItemController.php b/lib/Controller/ItemController.php
index 757f2f115..7eeaa26ed 100644
--- a/lib/Controller/ItemController.php
+++ b/lib/Controller/ItemController.php
@@ -311,21 +311,22 @@ class ItemController extends Controller
/**
* @NoAdminRequired
*
- * @param int $itemId
- * @param string $shareWithId
- * @return array
+ * @param int $itemId Item to share
+ * @param string $shareWithId User to share with
*/
public function share($itemId, $shareWithId)
{
try {
- $exists = $this->itemService->checkSharing($itemId, $shareWithId, $this->userId);
-
- if($exists==0){
- $this->itemService->shareItem($itemId, $shareWithId, $this->userId);
- }
+ $this->itemService->share(
+ $this->getUserId(),
+ $itemId,
+ $shareWithId
+ );
} catch (ServiceNotFoundException $ex) {
return $this->error($ex, Http::STATUS_NOT_FOUND);
}
+
+ return [];
}
}