1
0
mirror of https://github.com/freescout-helpdesk/freescout.git synced 2024-11-24 19:33:07 +01:00
freescout/app/Policies/FolderPolicy.php
2018-07-23 03:12:20 -07:00

33 lines
672 B
PHP

<?php
namespace App\Policies;
use App\User;
use App\Folder;
use Illuminate\Auth\Access\HandlesAuthorization;
class FolderPolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view the folder.
*
* @param \App\User $user
* @param \App\Folder $folder
* @return bool
*/
public function view(User $user, Folder $folder)
{
if ($user->isAdmin()) {
return true;
} else {
if ($folder->user_id == $user->id || $user->mailboxes->contains($folder->mailbox)) {
return true;
} else {
return false;
}
}
}
}