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

33 lines
685 B
PHP

<?php
namespace App\Policies;
use App\User;
use App\Conversation;
use Illuminate\Auth\Access\HandlesAuthorization;
class ConversationPolicy
{
use HandlesAuthorization;
/**
* Determine whether the user can view the conversation.
*
* @param \App\User $user
* @param \App\Conversation $conversation
* @return bool
*/
public function view(User $user, Conversation $conversation)
{
if ($user->isAdmin()) {
return true;
} else {
if ($conversation->mailbox()->users->contains($user)) {
return true;
} else {
return false;
}
}
}
}