added it_rename_shared_file test

This commit is contained in:
Peter Papp
2021-03-10 11:02:05 +01:00
parent 8a4ffd03c6
commit 1126a45524
5 changed files with 76 additions and 16 deletions
@@ -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
+12
View File
@@ -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')
+1 -1
View File
@@ -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();