當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。