From e9d84d87f5497f38ab9d5b7e4d050db5ce434e3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Molakvo=C3=A6=20=28skjnldsv=29?= Date: Wed, 6 May 2020 12:39:52 +0200 Subject: [PATCH] Use ShareWith and filter shares on the fly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- lib/Controller/ApiController.php | 4 +- lib/Service/FormsService.php | 4 +- src/components/{shareDiv.vue => ShareDiv.vue} | 46 +++++++++---------- src/components/UserDiv.vue | 4 +- src/views/Sidebar.vue | 2 +- 5 files changed, 28 insertions(+), 32 deletions(-) rename src/components/{shareDiv.vue => ShareDiv.vue} (87%) diff --git a/lib/Controller/ApiController.php b/lib/Controller/ApiController.php index b402aa6..c82fa1b 100644 --- a/lib/Controller/ApiController.php +++ b/lib/Controller/ApiController.php @@ -216,10 +216,10 @@ class ApiController extends Controller { try { if ($keyValuePairs['access']) { $keyValuePairs['access']['users'] = array_map(function (array $user): string { - return $user['id']; + return $user['shareWith']; }, $keyValuePairs['access']['users']); $keyValuePairs['access']['groups'] = array_map(function (array $group): string { - return $group['id']; + return $group['shareWith']; }, $keyValuePairs['access']['groups']); } } catch (Exception $e) { diff --git a/lib/Service/FormsService.php b/lib/Service/FormsService.php index d1ab379..ee16c69 100644 --- a/lib/Service/FormsService.php +++ b/lib/Service/FormsService.php @@ -234,7 +234,7 @@ class FormsService { $user = $this->userManager->get($userId); if ($user instanceof IUser) { return [ - 'id' => $userId, + 'shareWith' => $userId, 'displayName' => $user->getDisplayName(), 'shareType' => IShare::TYPE_USER ]; @@ -252,7 +252,7 @@ class FormsService { $group = $this->groupManager->get($groupId); if ($group instanceof IGroup) { return [ - 'id' => $groupId, + 'shareWith' => $groupId, 'displayName' => $group->getDisplayName(), 'shareType' => IShare::TYPE_GROUP ]; diff --git a/src/components/shareDiv.vue b/src/components/ShareDiv.vue similarity index 87% rename from src/components/shareDiv.vue rename to src/components/ShareDiv.vue index 0cea5fd..5d6cf4c 100644 --- a/src/components/shareDiv.vue +++ b/src/components/ShareDiv.vue @@ -35,7 +35,7 @@ :searchable="true" :user-select="true" label="displayName" - track-by="id" + track-by="shareWith" @search-change="asyncFind" @select="addShare">