当前位置: 首页>>代码示例>>PHP>>正文


PHP wc_rest_check_manager_permissions函数代码示例

本文整理汇总了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;
 }
开发者ID:Korkey128k,项目名称:woocommerce,代码行数:13,代码来源:class-wc-rest-system-status-controller.php

示例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;
 }
开发者ID:tlovett1,项目名称:woocommerce,代码行数:13,代码来源:class-wc-rest-system-status-tools-controller.php

示例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;
 }
开发者ID:woocommerce,项目名称:woocommerce,代码行数:13,代码来源:class-wc-rest-payment-gateways-controller.php

示例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;
 }
开发者ID:unfulvio,项目名称:woocommerce,代码行数:13,代码来源:class-wc-rest-tax-classes-controller.php

示例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;
 }
开发者ID:tlovett1,项目名称:woocommerce,代码行数:13,代码来源:class-wc-rest-product-attributes-controller.php

示例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;
 }
开发者ID:unfulvio,项目名称:woocommerce,代码行数:16,代码来源:class-wc-rest-product-attributes-controller.php

示例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;
 }
开发者ID:jimlove7273,项目名称:woocommerce,代码行数:16,代码来源:abstract-wc-rest-shipping-zones-controller.php

示例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'));
 }
开发者ID:pelmered,项目名称:woocommerce,代码行数:9,代码来源:functions.php


注:本文中的wc_rest_check_manager_permissions函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。