| @@ -18,8 +18,9 @@ | ||
| 18 | 18 | namespace WCPOS\WooCommercePOS\Templates; |
| 19 | 19 | |
| 20 | 20 | use WCPOS\WooCommercePOS\Logger; |
| 21 | 21 | use WCPOS\WooCommercePOS\Services\Auth as AuthService; |
| 22 | +use WCPOS\WooCommercePOS\Services\Cashier; | |
| 22 | 23 | use WP_Error; |
| 23 | 24 | use WP_User; |
| 24 | 25 | |
| 25 | 26 | /** |
| @@ -316,11 +317,11 @@ | ||
| 316 | 317 | return; |
| 317 | 318 | } |
| 318 | 319 | |
| 319 | 320 | // Check if user has access to POS. |
| 320 | - if ( ! user_can( $user, 'access_woocommerce_pos' ) ) { | |
| 321 | + if ( ! Cashier::instance()->can_open_pos( $user ) ) { | |
| 321 | 322 | $this->log_auth_attempt( $username, 'no_permission' ); |
| 322 | - $this->error = __( 'You do not have permission to access the POS.', 'woocommerce-pos' ); | |
| 323 | + $this->error = Cashier::instance()->missing_pos_capabilities_message( $user ); | |
| 323 | 324 | |
| 324 | 325 | return; |
| 325 | 326 | } |
| 326 | 327 | |