wc_rest_check_manager_permissions( string $object, string $context = 'read' )
Check manager permissions on REST API.
Description #Description
Parameters #Parameters
- $object
-
(Required) Object.
- $context
-
(Optional) Request context.
Default value: 'read'
Return #Return
(bool)
Source #Source
File: includes/wc-rest-functions.php
function wc_rest_check_manager_permissions( $object, $context = 'read' ) {
$objects = array(
'reports' => 'view_woocommerce_reports',
'settings' => 'manage_woocommerce',
'system_status' => 'manage_woocommerce',
'attributes' => 'manage_product_terms',
'shipping_methods' => 'manage_woocommerce',
'payment_gateways' => 'manage_woocommerce',
'webhooks' => 'manage_woocommerce',
);
$permission = current_user_can( $objects[ $object ] );
return apply_filters( 'woocommerce_rest_check_permissions', $permission, $context, 0, $object );
}
Changelog #Changelog
| Version | Description |
|---|---|
| 2.6.0 | Introduced. |
Related #Related
Used By #Used By
| Used By | Description |
|---|---|
| packages/woocommerce-admin/src/API/ProductAttributeTerms.php: ProductAttributeTerms::get_custom_attribute_permissions_check() |
Check if a given request has access to read a custom attribute. |
| packages/woocommerce-admin/src/API/OnboardingProfile.php: OnboardingProfile::get_items_permissions_check() |
Check whether a given request has permission to read onboarding profile data. |
| packages/woocommerce-admin/src/API/OnboardingProfile.php: OnboardingProfile::update_items_permissions_check() |
Check whether a given request has permission to edit onboarding profile data. |
| packages/woocommerce-admin/src/API/Notes.php: Notes::get_items_permissions_check() |
Check whether a given request has permission to read notes. |
| packages/woocommerce-admin/src/API/Notes.php: Notes::update_items_permissions_check() |
Makes sure the current user has access to WRITE the settings APIs. |
| packages/woocommerce-admin/src/API/Notes.php: Notes::get_item_permissions_check() |
Check whether a given request has permission to read a single note. |
| packages/woocommerce-admin/src/API/Reports/Controller.php: Controller::get_items_permissions_check() |
Check whether a given request has permission to read reports. |
| packages/woocommerce-admin/src/API/Reports/Import/Controller.php: Controller::import_permissions_check() |
Makes sure the current user has access to WRITE the settings APIs. |
| includes/rest-api/Controllers/Version3/class-wc-rest-shipping-zones-controller-base.php: WC_REST_Shipping_Zones_Controller_Base::get_items_permissions_check() |
Check whether a given request has permission to read Shipping Zones. |
| includes/rest-api/Controllers/Version3/class-wc-rest-shipping-zones-controller-base.php: WC_REST_Shipping_Zones_Controller_Base::create_item_permissions_check() |
Check if a given request has access to create Shipping Zones. |
| includes/rest-api/Controllers/Version3/class-wc-rest-shipping-zones-controller-base.php: WC_REST_Shipping_Zones_Controller_Base::update_items_permissions_check() |
Check whether a given request has permission to edit Shipping Zones. |
| includes/rest-api/Controllers/Version3/class-wc-rest-shipping-zones-controller-base.php: WC_REST_Shipping_Zones_Controller_Base::delete_items_permissions_check() |
Check whether a given request has permission to delete Shipping Zones. |
| includes/rest-api/Controllers/Version3/class-wc-rest-settings-controller.php: WC_REST_Settings_Controller::update_items_permissions_check() |
Makes sure the current user has access to WRITE the settings APIs. |
| includes/rest-api/Controllers/Version3/class-wc-rest-data-controller.php: WC_REST_Data_Controller::get_items_permissions_check() |
Check whether a given request has permission to read site data. |
| includes/rest-api/Controllers/Version3/class-wc-rest-data-controller.php: WC_REST_Data_Controller::get_item_permissions_check() |
Check whether a given request has permission to read site settings. |
| includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php: WC_REST_Product_Attributes_V1_Controller::get_items_permissions_check() |
Check if a given request has access to read the attributes. |
| includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php: WC_REST_Product_Attributes_V1_Controller::create_item_permissions_check() |
Check if a given request has access to create a attribute. |
| includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php: WC_REST_Product_Attributes_V1_Controller::get_item_permissions_check() |
Check if a given request has access to read a attribute. |
| includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php: WC_REST_Product_Attributes_V1_Controller::update_item_permissions_check() |
Check if a given request has access to update a attribute. |
| includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php: WC_REST_Product_Attributes_V1_Controller::delete_item_permissions_check() |
Check if a given request has access to delete a attribute. |
| includes/rest-api/Controllers/Version1/class-wc-rest-product-attributes-v1-controller.php: WC_REST_Product_Attributes_V1_Controller::batch_items_permissions_check() |
Check if a given request has access batch create, update and delete items. |
| includes/rest-api/Controllers/Version1/class-wc-rest-webhook-deliveries-v1-controller.php: WC_REST_Webhook_Deliveries_V1_Controller::get_items_permissions_check() |
Check whether a given request has permission to read taxes. |
| includes/rest-api/Controllers/Version1/class-wc-rest-webhook-deliveries-v1-controller.php: WC_REST_Webhook_Deliveries_V1_Controller::get_item_permissions_check() |
Check if a given request has access to read a tax. |
| includes/rest-api/Controllers/Version1/class-wc-rest-tax-classes-v1-controller.php: WC_REST_Tax_Classes_V1_Controller::get_items_permissions_check() |
Check whether a given request has permission to read tax classes. |
| includes/rest-api/Controllers/Version1/class-wc-rest-tax-classes-v1-controller.php: WC_REST_Tax_Classes_V1_Controller::create_item_permissions_check() |
Check if a given request has access create tax classes. |
| includes/rest-api/Controllers/Version1/class-wc-rest-tax-classes-v1-controller.php: WC_REST_Tax_Classes_V1_Controller::delete_item_permissions_check() |
Check if a given request has access delete a tax. |
| includes/rest-api/Controllers/Version1/class-wc-rest-report-sales-v1-controller.php: WC_REST_Report_Sales_V1_Controller::get_items_permissions_check() |
Check whether a given request has permission to read report. |
| includes/rest-api/Controllers/Version1/class-wc-rest-reports-v1-controller.php: WC_REST_Reports_V1_Controller::get_items_permissions_check() |
Check whether a given request has permission to read reports. |
| includes/rest-api/Controllers/Version1/class-wc-rest-webhooks-v1-controller.php: WC_REST_Webhooks_V1_Controller::get_items_permissions_check() |
Check whether a given request has permission to read webhooks. |
| includes/rest-api/Controllers/Version1/class-wc-rest-webhooks-v1-controller.php: WC_REST_Webhooks_V1_Controller::create_item_permissions_check() |
Check if a given request has access create webhooks. |
| includes/rest-api/Controllers/Version1/class-wc-rest-webhooks-v1-controller.php: WC_REST_Webhooks_V1_Controller::get_item_permissions_check() |
Check if a given request has access to read a webhook. |
| includes/rest-api/Controllers/Version1/class-wc-rest-webhooks-v1-controller.php: WC_REST_Webhooks_V1_Controller::update_item_permissions_check() |
Check if a given request has access update a webhook. |
| includes/rest-api/Controllers/Version1/class-wc-rest-webhooks-v1-controller.php: WC_REST_Webhooks_V1_Controller::delete_item_permissions_check() |
Check if a given request has access delete a webhook. |
| includes/rest-api/Controllers/Version1/class-wc-rest-webhooks-v1-controller.php: WC_REST_Webhooks_V1_Controller::batch_items_permissions_check() |
Check if a given request has access batch create, update and delete items. |
| includes/rest-api/Controllers/Version1/class-wc-rest-taxes-v1-controller.php: WC_REST_Taxes_V1_Controller::get_items_permissions_check() |
Check whether a given request has permission to read taxes. |
| includes/rest-api/Controllers/Version1/class-wc-rest-taxes-v1-controller.php: WC_REST_Taxes_V1_Controller::create_item_permissions_check() |
Check if a given request has access create taxes. |
| includes/rest-api/Controllers/Version1/class-wc-rest-taxes-v1-controller.php: WC_REST_Taxes_V1_Controller::get_item_permissions_check() |
Check if a given request has access to read a tax. |
| includes/rest-api/Controllers/Version1/class-wc-rest-taxes-v1-controller.php: WC_REST_Taxes_V1_Controller::update_item_permissions_check() |
Check if a given request has access update a tax. |
| includes/rest-api/Controllers/Version1/class-wc-rest-taxes-v1-controller.php: WC_REST_Taxes_V1_Controller::delete_item_permissions_check() |
Check if a given request has access delete a tax. |
| includes/rest-api/Controllers/Version1/class-wc-rest-taxes-v1-controller.php: WC_REST_Taxes_V1_Controller::batch_items_permissions_check() |
Check if a given request has access batch create, update and delete items. |
| includes/rest-api/Controllers/Version2/class-wc-rest-setting-options-v2-controller.php: WC_REST_Setting_Options_V2_Controller::get_items_permissions_check() |
Makes sure the current user has access to READ the settings APIs. |
| includes/rest-api/Controllers/Version2/class-wc-rest-setting-options-v2-controller.php: WC_REST_Setting_Options_V2_Controller::update_items_permissions_check() |
Makes sure the current user has access to WRITE the settings APIs. |
| includes/rest-api/Controllers/Version2/class-wc-rest-settings-v2-controller.php: WC_REST_Settings_V2_Controller::get_items_permissions_check() |
Makes sure the current user has access to READ the settings APIs. |
| includes/rest-api/Controllers/Version2/class-wc-rest-system-status-tools-v2-controller.php: WC_REST_System_Status_Tools_V2_Controller::get_items_permissions_check() |
Check whether a given request has permission to view system status tools. |
| includes/rest-api/Controllers/Version2/class-wc-rest-system-status-tools-v2-controller.php: WC_REST_System_Status_Tools_V2_Controller::get_item_permissions_check() |
Check whether a given request has permission to view a specific system status tool. |
| includes/rest-api/Controllers/Version2/class-wc-rest-system-status-tools-v2-controller.php: WC_REST_System_Status_Tools_V2_Controller::update_item_permissions_check() |
Check whether a given request has permission to execute a specific system status tool. |
| includes/rest-api/Controllers/Version2/class-wc-rest-shipping-methods-v2-controller.php: WC_REST_Shipping_Methods_V2_Controller::get_items_permissions_check() |
Check whether a given request has permission to view shipping methods. |
| includes/rest-api/Controllers/Version2/class-wc-rest-shipping-methods-v2-controller.php: WC_REST_Shipping_Methods_V2_Controller::get_item_permissions_check() |
Check if a given request has access to read a shipping method. |
| includes/rest-api/Controllers/Version2/class-wc-rest-payment-gateways-v2-controller.php: WC_REST_Payment_Gateways_V2_Controller::get_items_permissions_check() |
Check whether a given request has permission to view payment gateways. |
| includes/rest-api/Controllers/Version2/class-wc-rest-payment-gateways-v2-controller.php: WC_REST_Payment_Gateways_V2_Controller::get_item_permissions_check() |
Check if a given request has access to read a payment gateway. |
| includes/rest-api/Controllers/Version2/class-wc-rest-payment-gateways-v2-controller.php: WC_REST_Payment_Gateways_V2_Controller::update_items_permissions_check() |
Check whether a given request has permission to edit payment gateways. |
| includes/rest-api/Controllers/Version2/class-wc-rest-system-status-v2-controller.php: WC_REST_System_Status_V2_Controller::get_items_permissions_check() |
Check whether a given request has permission to view system status. |