canDo('master_difficulty.master_difficulty.view') && $authUser->isAdmin()) { return true; } return $master_difficulty->user_id == user_id() && $master_difficulty->user_type == user_type(); } /** * Determine if the given user can create a master_difficulty. * * @param UserPolicyInterface $authUser * * @return bool */ public function create(UserPolicyInterface $authUser) { return $authUser->canDo('master_difficulty.master_difficulty.create'); } /** * Determine if the given user can update the given master_difficulty. * * @param UserPolicyInterface $authUser * @param MasterDifficulty $master_difficulty * * @return bool */ public function update(UserPolicyInterface $authUser, MasterDifficulty $master_difficulty) { if ($authUser->canDo('master_difficulty.master_difficulty.edit') && $authUser->isAdmin()) { return true; } return $master_difficulty->user_id == user_id() && $master_difficulty->user_type == user_type(); } /** * Determine if the given user can delete the given master_difficulty. * * @param UserPolicyInterface $authUser * * @return bool */ public function destroy(UserPolicyInterface $authUser, MasterDifficulty $master_difficulty) { return $master_difficulty->user_id == user_id() && $master_difficulty->user_type == user_type(); } /** * Determine if the given user can verify the given master_difficulty. * * @param UserPolicyInterface $authUser * * @return bool */ public function verify(UserPolicyInterface $authUser, MasterDifficulty $master_difficulty) { if ($authUser->canDo('master_difficulty.master_difficulty.verify')) { return true; } return false; } /** * Determine if the given user can approve the given master_difficulty. * * @param UserPolicyInterface $authUser * * @return bool */ public function approve(UserPolicyInterface $authUser, MasterDifficulty $master_difficulty) { if ($authUser->canDo('master_difficulty.master_difficulty.approve')) { return true; } return false; } /** * Determine if the user can perform a given action ve. * * @param [type] $authUser [description] * @param [type] $ability [description] * * @return [type] [description] */ public function before($authUser, $ability) { if ($authUser->isSuperuser()) { return true; } } }