mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-05-15 01:35:02 +00:00
added it_rename_shared_file test
This commit is contained in:
@@ -144,10 +144,12 @@ class EditItemsController extends Controller
|
||||
}
|
||||
|
||||
// Check shared permission
|
||||
if (!is_editor($shared)) abort(403);
|
||||
if (is_visitor($shared)) {
|
||||
abort(403);
|
||||
}
|
||||
|
||||
// Get file|folder item
|
||||
$item = get_item($request->type, $id, $shared->user_id);
|
||||
$item = get_item($request->type, $id);
|
||||
|
||||
// Check access to requested item
|
||||
if ($request->type === 'folder') {
|
||||
@@ -158,8 +160,7 @@ class EditItemsController extends Controller
|
||||
|
||||
// If request have a change folder icon values set the folder icon
|
||||
if ($request->type === 'folder' && $request->filled('icon')) {
|
||||
|
||||
Editor::set_folder_icon($request->icon, $id, $shared);
|
||||
Editor::set_folder_icon($request, $id);
|
||||
}
|
||||
|
||||
// Rename item
|
||||
|
||||
@@ -220,6 +220,17 @@ function is_editor($shared)
|
||||
return $shared->permission === 'editor';
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if shared permission is visitor
|
||||
*
|
||||
* @param $shared
|
||||
* @return bool
|
||||
*/
|
||||
function is_visitor($shared)
|
||||
{
|
||||
return $shared->permission === 'visitor';
|
||||
}
|
||||
|
||||
/**
|
||||
* Store user avatar to storage
|
||||
*
|
||||
@@ -419,6 +430,7 @@ function appeared_once($arr)
|
||||
|
||||
/**
|
||||
* @param $folders
|
||||
* @param string $by_column
|
||||
* @return array
|
||||
*/
|
||||
function filter_folders_ids($folders, $by_column = 'id')
|
||||
|
||||
@@ -18,7 +18,7 @@ class Guardian
|
||||
public static function check_item_access($requested_id, $shared)
|
||||
{
|
||||
// Get all children folders
|
||||
$foldersIds = Folder::with('folders:id,parent_id,unique_id,name')
|
||||
$foldersIds = Folder::with('folders:id,parent_id,id,name')
|
||||
->where('user_id', $shared->user_id)
|
||||
->where('parent_id', $shared->item_id)
|
||||
->get();
|
||||
|
||||
Reference in New Issue
Block a user