mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-05 18:23:48 +00:00
DesktopToolbar.vue team members widget resolving
This commit is contained in:
@@ -59,7 +59,7 @@
|
||||
"/chunks/plan-subscribers.js": "/chunks/plan-subscribers.js?id=2bdbb5f9141052aaaa3d",
|
||||
"/chunks/plans.js": "/chunks/plans.js?id=a3a16f546521050656fb",
|
||||
"/chunks/platform.js": "/chunks/platform.js?id=07fd139d62a2c60f9468",
|
||||
"/chunks/platform~chunks/shared.js": "/chunks/platform~chunks/shared.js?id=e914b8a5e845646456c3",
|
||||
"/chunks/platform~chunks/shared.js": "/chunks/platform~chunks/shared.js?id=6da8a930d3ab447dc666",
|
||||
"/chunks/profile.js": "/chunks/profile.js?id=91ea55260c78ea4e7abd",
|
||||
"/chunks/profile~chunks/settings-password.js": "/chunks/profile~chunks/settings-password.js?id=7b80324eef831d31e3e8",
|
||||
"/chunks/purchase-code.js": "/chunks/purchase-code.js?id=26a3951e09a8862d8dc2",
|
||||
@@ -182,5 +182,21 @@
|
||||
"/chunks/shared-with-me.54e36bd53fa339ec4fb7.hot-update.js": "/chunks/shared-with-me.54e36bd53fa339ec4fb7.hot-update.js",
|
||||
"/chunks/shared-with-me.17b05bf3b95620219457.hot-update.js": "/chunks/shared-with-me.17b05bf3b95620219457.hot-update.js",
|
||||
"/chunks/shared-with-me.4a8a25245ef7531c5735.hot-update.js": "/chunks/shared-with-me.4a8a25245ef7531c5735.hot-update.js",
|
||||
"/chunks/shared-with-me.2455d13237b72650ef8b.hot-update.js": "/chunks/shared-with-me.2455d13237b72650ef8b.hot-update.js"
|
||||
"/chunks/shared-with-me.2455d13237b72650ef8b.hot-update.js": "/chunks/shared-with-me.2455d13237b72650ef8b.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.c4d84777bd49629c7f4e.hot-update.js": "/chunks/platform~chunks/shared.c4d84777bd49629c7f4e.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.2002cbbac234f7eda6b0.hot-update.js": "/chunks/platform~chunks/shared.2002cbbac234f7eda6b0.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.d3f35c4b013d89a92526.hot-update.js": "/chunks/platform~chunks/shared.d3f35c4b013d89a92526.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.5505ecef8146fd90e641.hot-update.js": "/chunks/platform~chunks/shared.5505ecef8146fd90e641.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.44baf0152316974ff956.hot-update.js": "/chunks/platform~chunks/shared.44baf0152316974ff956.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.b850f5f0dbce66101ac6.hot-update.js": "/chunks/platform~chunks/shared.b850f5f0dbce66101ac6.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.fad4fcff2a55b7c9de5b.hot-update.js": "/chunks/platform~chunks/shared.fad4fcff2a55b7c9de5b.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.427068b74f3a9223c8af.hot-update.js": "/chunks/platform~chunks/shared.427068b74f3a9223c8af.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.7cd67170f606d88b046a.hot-update.js": "/chunks/platform~chunks/shared.7cd67170f606d88b046a.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.4a5f63d6af032394abb4.hot-update.js": "/chunks/platform~chunks/shared.4a5f63d6af032394abb4.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.85e2c221e154cdb096ca.hot-update.js": "/chunks/platform~chunks/shared.85e2c221e154cdb096ca.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.40220b39a67ea6947ada.hot-update.js": "/chunks/platform~chunks/shared.40220b39a67ea6947ada.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.cdc982ee462905db2739.hot-update.js": "/chunks/platform~chunks/shared.cdc982ee462905db2739.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.da8714bce7630fc753ba.hot-update.js": "/chunks/platform~chunks/shared.da8714bce7630fc753ba.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.1c7a870b7ada9ad6da18.hot-update.js": "/chunks/platform~chunks/shared.1c7a870b7ada9ad6da18.hot-update.js",
|
||||
"/chunks/platform~chunks/shared.d6227f7e312ed10fe374.hot-update.js": "/chunks/platform~chunks/shared.d6227f7e312ed10fe374.hot-update.js"
|
||||
}
|
||||
|
||||
@@ -16,14 +16,15 @@
|
||||
<ToolbarWrapper>
|
||||
|
||||
<!--Search bar-->
|
||||
<ToolbarGroup style="margin-left: 0">
|
||||
<ToolbarGroup v-if="false" style="margin-left: 0">
|
||||
<SearchBar />
|
||||
</ToolbarGroup>
|
||||
|
||||
<!--Creating controls-->
|
||||
<ToolbarGroup v-if="$checkPermission(['master', 'editor'])">
|
||||
<!--Create button for all pages except SharedWithMe-->
|
||||
<ToolbarGroup v-if="$checkPermission(['master', 'editor']) && ! $isThisRoute($route, ['SharedWithMe'])">
|
||||
<PopoverWrapper>
|
||||
<ToolbarButton @click.stop.native="showCreateMenu" source="cloud-plus" :action="$t('actions.create')" />
|
||||
|
||||
<PopoverItem name="desktop-create" side="left">
|
||||
<OptionGroup>
|
||||
<OptionUpload :class="{'is-inactive': canUploadInView || isTeamFolderHomepage }" :title="$t('actions.upload')" />
|
||||
@@ -36,6 +37,22 @@
|
||||
</PopoverWrapper>
|
||||
</ToolbarGroup>
|
||||
|
||||
<!--Create button for shared with me page-->
|
||||
<ToolbarGroup v-if="$isThisRoute($route, ['SharedWithMe'])">
|
||||
<PopoverWrapper>
|
||||
<ToolbarButton @click.stop.native="showCreateMenu" source="cloud-plus" :class="{'is-inactive': ! canEdit}" :action="$t('actions.create')" />
|
||||
|
||||
<PopoverItem name="desktop-create" side="left">
|
||||
<OptionGroup>
|
||||
<OptionUpload :class="{'is-inactive': canUploadInView || isSharedWithMeHomepage }" :title="$t('actions.upload')" />
|
||||
</OptionGroup>
|
||||
<OptionGroup>
|
||||
<Option @click.stop.native="$createFolder" :class="{'is-inactive': canCreateFolderInView || isSharedWithMeHomepage }" :title="$t('actions.create_folder')" icon="folder-plus" />
|
||||
</OptionGroup>
|
||||
</PopoverItem>
|
||||
</PopoverWrapper>
|
||||
</ToolbarGroup>
|
||||
|
||||
<!--Share Controls-->
|
||||
<ToolbarGroup v-if="! $isMobile() && ! $isThisRoute($route, ['Public'])">
|
||||
|
||||
@@ -121,7 +138,17 @@
|
||||
'currentFolder',
|
||||
'sharedDetail',
|
||||
'clipboard',
|
||||
'user',
|
||||
]),
|
||||
canEdit() {
|
||||
if (this.currentTeamFolder && this.user) {
|
||||
let member = this.currentTeamFolder.data.relationships.members.data.find(member => member.data.id === this.user.data.id)
|
||||
|
||||
return member.data.attributes.permission === 'can-edit'
|
||||
}
|
||||
|
||||
return false
|
||||
},
|
||||
teamFolder() {
|
||||
return this.currentTeamFolder
|
||||
? this.currentTeamFolder
|
||||
@@ -138,18 +165,23 @@
|
||||
return this.$isThisRoute(this.$route, ['TeamFolders'])
|
||||
&& ! this.$route.params.id
|
||||
},
|
||||
isSharedWithMeHomepage() {
|
||||
return this.$isThisRoute(this.$route, ['SharedWithMe'])
|
||||
&& ! this.$route.params.id
|
||||
},
|
||||
canCreateFolderInView() {
|
||||
return ! this.$isThisRoute(this.$route, ['Files', 'Public', 'TeamFolders'])
|
||||
return ! this.$isThisRoute(this.$route, ['Files', 'Public', 'TeamFolders', 'SharedWithMe'])
|
||||
},
|
||||
canShowConvertToTeamFolder() {
|
||||
return this.$isThisRoute(this.$route, ['Files', 'MySharedItems'])
|
||||
},
|
||||
canUploadInView() {
|
||||
return ! this.$isThisRoute(this.$route, ['Files', 'Public', 'TeamFolders'])
|
||||
return ! this.$isThisRoute(this.$route, ['Files', 'Public', 'TeamFolders', 'SharedWithMe'])
|
||||
},
|
||||
canDeleteInView() {
|
||||
let routes = [
|
||||
'TeamFolders',
|
||||
'SharedWithMe',
|
||||
'RecentUploads',
|
||||
'MySharedItems',
|
||||
'Trash',
|
||||
|
||||
@@ -128,7 +128,7 @@ class SetupDevEnvironment extends Command
|
||||
collect([
|
||||
[
|
||||
'avatar' => 'avatar-02.png',
|
||||
'email' => 'alice@vuefilemanager.com',
|
||||
'email' => 'alice@hi5ve.digital',
|
||||
],
|
||||
[
|
||||
'avatar' => 'avatar-03.png',
|
||||
@@ -801,7 +801,7 @@ class SetupDevEnvironment extends Command
|
||||
$member = User::whereEmail('howdy@hi5ve.digital')
|
||||
->first();
|
||||
|
||||
$owner = User::whereEmail('alice@vuefilemanager.com')
|
||||
$owner = User::whereEmail('alice@hi5ve.digital')
|
||||
->first();
|
||||
|
||||
$folder = Folder::factory()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
namespace App\Providers;
|
||||
|
||||
use Auth;
|
||||
use DB;
|
||||
use App\Users\Models\User;
|
||||
use Domain\Files\Models\File;
|
||||
@@ -89,11 +90,14 @@ class AuthServiceProvider extends ServiceProvider
|
||||
|
||||
private function team_member_guard(Folder | File $item, ?User $user, $ability): bool
|
||||
{
|
||||
$teamFolder = $item->getLatestParent();
|
||||
|
||||
$membership = DB::table('team_folder_members')
|
||||
->where('parent_id', $item->getLatestParent()->id)
|
||||
->where('parent_id', $teamFolder->id)
|
||||
->where('user_id', $user->id)
|
||||
->first();
|
||||
|
||||
return $membership?->permission === $ability;
|
||||
// check existing members permission or check team folder owner privileges
|
||||
return $membership?->permission === $ability || $teamFolder->user_id === Auth::id();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ class DeleteUserDataAction
|
||||
Storage::deleteDirectory("files/$user->id");
|
||||
|
||||
// Delete all user records in database
|
||||
collect(['folders', 'files', 'user_settings', 'shares', 'favourite_folder', 'zips', 'traffic'])
|
||||
collect(['folders', 'files', 'user_settings', 'shares', 'favourite_folder', 'traffic'])
|
||||
->each(function ($table) use ($user) {
|
||||
DB::table($table)
|
||||
->whereUserId($user->id)
|
||||
|
||||
@@ -28,14 +28,13 @@ class ShareController extends Controller
|
||||
CreateShareRequest $request,
|
||||
SendViaEmailAction $sendLinkToEmailAction,
|
||||
): ShareResource {
|
||||
$type = $request->input('type') === 'folder' ? 'folder' : 'file';
|
||||
$item = get_item($request->input('id'), $type);
|
||||
$item = get_item($request->input('type'), $request->input('id'));
|
||||
|
||||
$this->authorize('owner', $item);
|
||||
|
||||
$shared = Share::create([
|
||||
'password' => $request->has('password') ? bcrypt($request->input('password')) : null,
|
||||
'type' => $type,
|
||||
'type' => $request->input('type') === 'folder' ? 'folder' : 'file',
|
||||
'is_protected' => $request->input('isPassword'),
|
||||
'permission' => $request->input('permission') ?? null,
|
||||
'expire_in' => $request->input('expiration') ?? null,
|
||||
|
||||
@@ -33,13 +33,11 @@ class TeamFoldersController extends Controller
|
||||
|
||||
$folders = Folder::where('parent_id', $id)
|
||||
->where('team_folder', ! Str::isUuid($id))
|
||||
->where('user_id', Auth::id())
|
||||
->sortable()
|
||||
->get();
|
||||
|
||||
if ($id) {
|
||||
$files = File::where('parent_id', $id)
|
||||
->where('user_id', Auth::id())
|
||||
->sortable()
|
||||
->get();
|
||||
}
|
||||
|
||||
@@ -16,12 +16,12 @@ class UserShareTest extends TestCase
|
||||
*/
|
||||
public function it_share_single_file_without_password()
|
||||
{
|
||||
$file = File::factory(File::class)
|
||||
->create();
|
||||
|
||||
$user = User::factory(User::class)
|
||||
->create();
|
||||
|
||||
$file = File::factory(File::class)
|
||||
->create(['user_id' => $user->id]);
|
||||
|
||||
$this
|
||||
->actingAs($user)
|
||||
->postJson('/api/share', [
|
||||
@@ -49,12 +49,12 @@ class UserShareTest extends TestCase
|
||||
*/
|
||||
public function it_share_folder_without_password()
|
||||
{
|
||||
$folder = Folder::factory(Folder::class)
|
||||
->create();
|
||||
|
||||
$user = User::factory(User::class)
|
||||
->create();
|
||||
|
||||
$folder = Folder::factory(Folder::class)
|
||||
->create(['user_id' => $user->id]);
|
||||
|
||||
$this
|
||||
->actingAs($user)
|
||||
->postJson('/api/share', [
|
||||
@@ -82,12 +82,12 @@ class UserShareTest extends TestCase
|
||||
*/
|
||||
public function it_share_folder_with_password()
|
||||
{
|
||||
$folder = Folder::factory(Folder::class)
|
||||
->create();
|
||||
|
||||
$user = User::factory(User::class)
|
||||
->create();
|
||||
|
||||
$folder = Folder::factory(Folder::class)
|
||||
->create(['user_id' => $user->id]);
|
||||
|
||||
$this
|
||||
->actingAs($user)
|
||||
->postJson('/api/share', [
|
||||
@@ -121,12 +121,12 @@ class UserShareTest extends TestCase
|
||||
*/
|
||||
public function it_share_folder_with_expiration_time()
|
||||
{
|
||||
$folder = Folder::factory(Folder::class)
|
||||
->create();
|
||||
|
||||
$user = User::factory(User::class)
|
||||
->create();
|
||||
|
||||
$folder = Folder::factory(Folder::class)
|
||||
->create(['user_id' => $user->id]);
|
||||
|
||||
$this
|
||||
->actingAs($user)
|
||||
->postJson('/api/share', [
|
||||
@@ -148,12 +148,12 @@ class UserShareTest extends TestCase
|
||||
*/
|
||||
public function it_share_folder_and_send_link_for_multiple_email()
|
||||
{
|
||||
$folder = Folder::factory(Folder::class)
|
||||
->create();
|
||||
|
||||
$user = User::factory(User::class)
|
||||
->create();
|
||||
|
||||
$folder = Folder::factory(Folder::class)
|
||||
->create(['user_id' => $user->id]);
|
||||
|
||||
$this
|
||||
->actingAs($user)
|
||||
->postJson('/api/share', [
|
||||
@@ -175,12 +175,12 @@ class UserShareTest extends TestCase
|
||||
*/
|
||||
public function it_send_existing_shared_folder_for_multiple_email_once_again()
|
||||
{
|
||||
$folder = Folder::factory(Folder::class)
|
||||
->create();
|
||||
|
||||
$user = User::factory(User::class)
|
||||
->create();
|
||||
|
||||
$folder = Folder::factory(Folder::class)
|
||||
->create(['user_id' => $user->id]);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$this->postJson('/api/share', [
|
||||
@@ -202,17 +202,15 @@ class UserShareTest extends TestCase
|
||||
|
||||
/**
|
||||
* @test
|
||||
*
|
||||
* TODO: pridat test na zmazanie zip
|
||||
*/
|
||||
public function it_revoke_single_share_record()
|
||||
{
|
||||
$folder = Folder::factory(Folder::class)
|
||||
->create();
|
||||
|
||||
$user = User::factory(User::class)
|
||||
->create();
|
||||
|
||||
$folder = Folder::factory(Folder::class)
|
||||
->create(['user_id' => $user->id]);
|
||||
|
||||
Sanctum::actingAs($user);
|
||||
|
||||
$this->postJson('/api/share', [
|
||||
|
||||
Reference in New Issue
Block a user