rbrecruiter/app/Policies/UserPolicy.php
Miguel Nogueira 4eb115d165 Revert "Apply fixes from StyleCI (pull request #6)"
This reverts pull request #6.

> This pull request applies code style fixes from an analysis carried out by [StyleCI](https://bitbucket.styleci.io).
> 
> For more information, click [here](https://bitbucket.styleci.io/analyses/a2Jl7D).
2020-10-21 00:29:50 +00:00

53 lines
1.1 KiB
PHP

<?php
namespace App\Policies;
use App\User;
use Illuminate\Auth\Access\HandlesAuthorization;
class UserPolicy
{
use HandlesAuthorization;
/**
* Create a new policy instance.
*
* @return void
*/
public function __construct()
{
}
public function edit(User $authUser, User $user)
{
return $authUser->is($user) || $authUser->hasRole('admin');
}
// This refers to the admin tools that let staff update more information than users themselves can
public function adminEdit(User $authUser, User $user)
{
return $authUser->hasRole('admin') && $authUser->isNot($user);
}
public function viewStaff(User $user)
{
return $user->can('admin.stafflist');
}
public function viewPlayers(User $user)
{
return $user->can('admin.userlist');
}
public function terminate(User $authUser)
{
return $authUser->hasRole('admin');
}
public function delete(User $authUser, User $subject)
{
return $authUser->hasRole('admin') && $authUser->isNot($subject);
}
}