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