Skip to content

Commit

Permalink
Merge pull request #438 from pluginever/release/2.0.3
Browse files Browse the repository at this point in the history
Prepare release v2.0.3
  • Loading branch information
kawsarahmedr authored Sep 12, 2024
2 parents 599a5e3 + e1687de commit ab580bd
Show file tree
Hide file tree
Showing 14 changed files with 110 additions and 104 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "pluginever/wc-serial-numbers",
"description": "WC Serial Numbers",
"homepage": "https://pluginever.com/plugins/wc-serial-numbers/",
"homepage": "https://pluginever.com/plugins/woocommerce-serial-numbers-pro/",
"type": "wordpress-plugin",
"license": "GPL-v2 or later",
"prefer-stable": true,
Expand Down
84 changes: 42 additions & 42 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions includes/Admin/Products.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,9 @@ public static function product_save_data() {
return;
}

// Must have WC Serial Numbers manager role to access this endpoint.
if ( ! current_user_can( wcsn_get_manager_role() ) ) {
// Must have edit_post user capability to save this data.
if ( ! current_user_can( 'edit_post', $post->ID ) ) {
WCSN()->add_notice( __( 'You do not have permission to save this data.', 'wc-serial-numbers' ), 'error' );
return;
}

Expand Down
16 changes: 8 additions & 8 deletions includes/Admin/Requests.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public function __construct() {
public static function handle_edit_key() {
check_admin_referer( 'wcsn_edit_key' );

// Must have WC Serial Numbers manager role to access this endpoint.
if ( ! current_user_can( wcsn_get_manager_role() ) ) {
// Must have manage options user capability role to access this endpoint.
if ( ! current_user_can( 'manage_options' ) ) {
WCSN()->add_notice( __( 'You do not have permission to perform this action.', 'wc-serial-numbers' ), 'error' );
wp_safe_redirect( wp_get_referer() );
exit;
Expand Down Expand Up @@ -95,8 +95,8 @@ public static function handle_edit_key() {
public static function search_product() {
check_ajax_referer( 'wc_serial_numbers_search_nonce', 'nonce' );

// Must have WC Serial Numbers manager role to access this endpoint.
if ( ! current_user_can( wcsn_get_manager_role() ) ) {
// Must have manage options user capability role to access this endpoint.
if ( ! current_user_can( 'manage_options' ) ) {
wp_send_json_error( array( 'message' => esc_html__( 'You do not have permission to access this endpoint.', 'wc-serial-numbers' ) ) );
wp_die();
}
Expand Down Expand Up @@ -158,8 +158,8 @@ public static function search_product() {
public static function search_orders() {
check_ajax_referer( 'wc_serial_numbers_search_nonce', 'nonce' );

// Must have WC Serial Numbers manager role to access this endpoint.
if ( ! current_user_can( wcsn_get_manager_role() ) ) {
// Must have manage options user capability role to access this endpoint.
if ( ! current_user_can( 'manage_options' ) ) {
wp_send_json_error( array( 'message' => esc_html__( 'You do not have permission to access this endpoint.', 'wc-serial-numbers' ) ) );
wp_die();
}
Expand Down Expand Up @@ -233,8 +233,8 @@ public static function search_orders() {
public static function search_customers() {
check_ajax_referer( 'wc_serial_numbers_search_nonce', 'nonce' );

// Must have WC Serial Numbers manager role to access this endpoint.
if ( ! current_user_can( wcsn_get_manager_role() ) ) {
// Must have manage options user capability role to access this endpoint.
if ( ! current_user_can( 'manage_options' ) ) {
wp_send_json_error( array( 'message' => esc_html__( 'You do not have permission to access this endpoint.', 'wc-serial-numbers' ) ) );
wp_die();
}
Expand Down
Loading

0 comments on commit ab580bd

Please sign in to comment.