Skip to content

Commit

Permalink
Fix: "Sorry, you cannot list resources." error for cashier role
Browse files Browse the repository at this point in the history
  • Loading branch information
kilbot committed Jun 3, 2024
1 parent ebc94d4 commit 9eea9f8
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 3 deletions.
13 changes: 13 additions & 0 deletions includes/API/Data_Order_Statuses_Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,17 @@ public function get_item_schema() {

return $this->add_additional_fields_schema( $schema );
}

/**
* Check whether a given request has permission to view order statuses.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_Error|boolean
*/
public function get_items_permissions_check( $request ) {
if ( is_user_logged_in() ) {
return true;
}
return parent::get_items_permissions_check( $request );
}
}
13 changes: 13 additions & 0 deletions includes/API/Shipping_Methods_Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,17 @@ class Shipping_Methods_Controller extends WC_REST_Shipping_Methods_Controller {
* @var string
*/
protected $namespace = 'wcpos/v1';

/**
* Check whether a given request has permission to view shipping methods.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_Error|boolean
*/
public function get_items_permissions_check( $request ) {
if ( is_user_logged_in() ) {
return true;
}
return parent::get_items_permissions_check( $request );
}
}
13 changes: 13 additions & 0 deletions includes/API/Tax_Classes_Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,17 @@ class Tax_Classes_Controller extends WC_REST_Tax_Classes_Controller {
* @var string
*/
protected $namespace = 'wcpos/v1';

/**
* Check whether a given request has permission to view tax classes.
*
* @param WP_REST_Request $request Full details about the request.
* @return WP_Error|boolean
*/
public function get_items_permissions_check( $request ) {
if ( is_user_logged_in() ) {
return true;
}
return parent::get_items_permissions_check( $request );
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wcpos/woocommerce-pos",
"version": "1.5.0",
"version": "1.5.1",
"description": "A simple front-end for taking WooCommerce orders at the Point of Sale.",
"main": "index.js",
"workspaces": {
Expand Down
4 changes: 4 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ There is more information on our website at [https://wcpos.com](https://wcpos.co

== Changelog ==

= 1.5.1 - 2024/06/03 =
* Fix: "Sorry, you cannot list resources." error for cashier role


= 1.5.0 - 2024/06/03 =
* Fix: the POS will now correctly sync stock quantity after each sale
* Fix: cart tax logic has been improved to fix rounding issues
Expand Down
4 changes: 2 additions & 2 deletions woocommerce-pos.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: WooCommerce POS
* Plugin URI: https://wordpress.org/plugins/woocommerce-pos/
* Description: A simple front-end for taking WooCommerce orders at the Point of Sale. Requires <a href="http://wordpress.org/plugins/woocommerce/">WooCommerce</a>.
* Version: 1.5.0
* Version: 1.5.1
* Author: kilbot
* Author URI: http://wcpos.com
* Text Domain: woocommerce-pos
Expand All @@ -26,7 +26,7 @@
namespace WCPOS\WooCommercePOS;

// Define plugin constants.
const VERSION = '1.5.0';
const VERSION = '1.5.1';
const PLUGIN_NAME = 'woocommerce-pos';
const SHORT_NAME = 'wcpos';
\define( __NAMESPACE__ . '\PLUGIN_FILE', plugin_basename( __FILE__ ) ); // 'woocommerce-pos/woocommerce-pos.php'
Expand Down

0 comments on commit 9eea9f8

Please sign in to comment.