canDo('aml.edd.view') && $authUser->isAdmin()) { return true; } return $edd->user_id == user_id() && $edd->user_type == user_type(); } /** * Determine if the given user can create a edd. * * @param UserPolicyInterface $authUser * * @return bool */ public function create(UserPolicyInterface $authUser) { return $authUser->canDo('aml.edd.create'); } /** * Determine if the given user can update the given edd. * * @param UserPolicyInterface $authUser * @param Edd $edd * * @return bool */ public function update(UserPolicyInterface $authUser, Edd $edd) { if ($authUser->canDo('aml.edd.edit') && $authUser->isAdmin()) { return true; } return $edd->user_id == user_id() && $edd->user_type == user_type(); } /** * Determine if the given user can delete the given edd. * * @param UserPolicyInterface $authUser * * @return bool */ public function destroy(UserPolicyInterface $authUser, Edd $edd) { return $edd->user_id == user_id() && $edd->user_type == user_type(); } /** * Determine if the given user can verify the given edd. * * @param UserPolicyInterface $authUser * * @return bool */ public function verify(UserPolicyInterface $authUser, Edd $edd) { if ($authUser->canDo('aml.edd.verify')) { return true; } return false; } /** * Determine if the given user can approve the given edd. * * @param UserPolicyInterface $authUser * * @return bool */ public function approve(UserPolicyInterface $authUser, Edd $edd) { if ($authUser->canDo('aml.edd.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; } } }