本文整理匯總了PHP中wc_rest_check_manager_permissions函數的典型用法代碼示例。如果您正苦於以下問題:PHP wc_rest_check_manager_permissions函數的具體用法?PHP wc_rest_check_manager_permissions怎麽用?PHP wc_rest_check_manager_permissions使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了wc_rest_check_manager_permissions函數的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: get_items_permissions_check
/**
* Check whether a given request has permission to view system status.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_Error|boolean
*/
public function get_items_permissions_check($request)
{
if (!wc_rest_check_manager_permissions('system_status', 'read')) {
return new WP_Error('woocommerce_rest_cannot_view', __('Sorry, you cannot list resources.', 'woocommerce'), array('status' => rest_authorization_required_code()));
}
return true;
}
示例2: update_item_permissions_check
/**
* Check whether a given request has permission to execute a specific system status tool.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_Error|boolean
*/
public function update_item_permissions_check($request)
{
if (!wc_rest_check_manager_permissions('system_status', 'edit')) {
return new WP_Error('woocommerce_rest_cannot_update', __('Sorry, you cannot update resource.', 'woocommerce'), array('status' => rest_authorization_required_code()));
}
return true;
}
示例3: update_items_permissions_check
/**
* Check whether a given request has permission to edit payment gateways.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_Error|boolean
*/
public function update_items_permissions_check($request)
{
if (!wc_rest_check_manager_permissions('payment_gateways', 'edit')) {
return new WP_Error('woocommerce_rest_cannot_edit', __('Sorry, you are not allowed to edit this resource.', 'woocommerce'), array('status' => rest_authorization_required_code()));
}
return true;
}
示例4: delete_item_permissions_check
/**
* Check if a given request has access delete a tax.
*
* @param WP_REST_Request $request Full details about the request.
* @return boolean
*/
public function delete_item_permissions_check($request)
{
if (!wc_rest_check_manager_permissions('settings', 'delete')) {
return new WP_Error('woocommerce_rest_cannot_delete', __('Sorry, you are not allowed to delete this resource.', 'woocommerce'), array('status' => rest_authorization_required_code()));
}
return true;
}
示例5: batch_items_permissions_check
/**
* Check if a given request has access batch create, update and delete items.
*
* @param WP_REST_Request $request Full details about the request.
* @return boolean
*/
public function batch_items_permissions_check($request)
{
if (!wc_rest_check_manager_permissions('attributes', 'batch')) {
return new WP_Error('woocommerce_rest_cannot_batch', __('Sorry, you are not allowed to batch manipulate this resource.', 'woocommerce'), array('status' => rest_authorization_required_code()));
}
return true;
}
示例6: delete_item_permissions_check
/**
* Check if a given request has access to delete a attribute.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_Error|boolean
*/
public function delete_item_permissions_check($request)
{
if (!$this->get_taxonomy($request)) {
return new WP_Error("woocommerce_rest_taxonomy_invalid", __("Resource doesn't exist.", 'woocommerce'), array('status' => 404));
}
if (!wc_rest_check_manager_permissions('attributes', 'delete')) {
return new WP_Error('woocommerce_rest_cannot_delete', __('Sorry, you cannot delete resource.', 'woocommerce'), array('status' => rest_authorization_required_code()));
}
return true;
}
示例7: delete_items_permissions_check
/**
* Check whether a given request has permission to delete Shipping Zones.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_Error|boolean
*/
public function delete_items_permissions_check($request)
{
if (!wc_shipping_enabled()) {
return new WP_Error('rest_no_route', __('Shipping is disabled.', 'woocommerce'), array('status' => 404));
}
if (!wc_rest_check_manager_permissions('settings', 'delete')) {
return new WP_Error('woocommerce_rest_cannot_edit', __('Sorry, you are not allowed to delete this resource.', 'woocommerce'), array('status' => rest_authorization_required_code()));
}
return true;
}
示例8: test_wc_rest_check_manager_permissions
/**
* Test wc_rest_check_manager_permissions().
*
* @since 2.6.0
*/
public function test_wc_rest_check_manager_permissions()
{
$this->isFalse(wc_rest_check_manager_permissions('reports'));
}