mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-26 18:30:38 +00:00
- gate implementation
- protected shared view fix
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
namespace Domain\Files\Controllers;
|
||||
|
||||
use Domain\Files\Models\File;
|
||||
use Gate;
|
||||
use Illuminate\Http\Response;
|
||||
use Domain\Sharing\Models\Share;
|
||||
use Domain\Files\Resources\FileResource;
|
||||
@@ -12,22 +13,16 @@ use Domain\Sharing\Actions\ProtectShareRecordAction;
|
||||
*/
|
||||
class VisitorShowFileController
|
||||
{
|
||||
public function __construct(
|
||||
private ProtectShareRecordAction $protectShareRecord,
|
||||
) {
|
||||
}
|
||||
|
||||
public function __invoke(
|
||||
Share $shared
|
||||
): Response {
|
||||
// Check ability to access protected share files
|
||||
($this->protectShareRecord)($shared);
|
||||
|
||||
// Get file
|
||||
$file = File::whereUserId($shared->user_id)
|
||||
->whereId($shared->item_id)
|
||||
->firstOrFail();
|
||||
|
||||
Gate::authorize('can-visit', [$file, $shared]);
|
||||
|
||||
// Set access urls
|
||||
$file->setPublicUrl($shared->token);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user