visitor zipping

This commit is contained in:
Peter Papp
2021-07-29 13:01:25 +02:00
parent 0ea7447901
commit 1f1f646f62
11 changed files with 190 additions and 199 deletions
@@ -5,14 +5,15 @@ use Domain\Sharing\Models\Share;
class ProtectShareRecordAction
{
private string $message = "Sorry, you don't have permission";
public function __invoke(
Share $shared
): void {
if ($shared->is_protected) {
$abort_message = "Sorry, you don't have permission";
if (! request()->hasCookie('share_session')) {
abort(403, $abort_message);
abort(403, $this->message);
}
// Get shared session
@@ -22,12 +23,12 @@ class ProtectShareRecordAction
// Check if is requested same share record
if ($share_session->token !== $shared->token) {
abort(403, $abort_message);
abort(403, $this->message);
}
// Check if share record was authenticated previously via ShareController@authenticate
if (! $share_session->authenticated) {
abort(403, $abort_message);
abort(403, $this->message);
}
}
}