PluginProbe
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments / 3.4.1
SureCart – Ecommerce Made Easy For Selling Physical Products, Digital Downloads, Subscriptions, Donations, & Payments v3.4.1
4.7.2 4.7.1 4.7.0 4.6.6 4.6.5 4.6.4 4.6.3 4.6.2 4.6.1 4.6.0 4.5.1 4.5.0 4.4.2 4.4.1 4.4.0 4.3.3 4.3.2 4.3.1 4.3.0 4.2.3 4.2.2 4.2.1 1.0.3 1.0.4 1.0.5 All 281 releases
surecart / packages / blocks / Controllers / Middleware / SubscriptionPermissionsControllerMiddleware.php
SubscriptionPermissionsControllerMiddleware.php
25 lines 616 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace SureCartBlocks\Controllers\Middleware;
3
4 use Closure;
5
6 /**
7 * Handles permissions check for subscription controller.
8 */
9 class SubscriptionPermissionsControllerMiddleware {
10 /**
11 * Handle the middleware.
12 *
13 * @param string $action Action.
14 * @param Closure $next Next.
15 * @return function
16 */
17 public function handle( string $action, Closure $next ) {
18 if ( ! current_user_can( 'edit_sc_subscription', $_GET['id'] ?? '', array( 'payment_method' => true ) ) ) {
19 return wp_die( esc_html__( 'You do not have permission to edit this subscription.', 'surecart' ) );
20 }
21
22 return $next();
23 }
24 }
25