Handle access to order delivery process page
This commit is contained in:
@@ -23,6 +23,15 @@ class Wiaas_Admin_Order_Process_Flow {
|
||||
public static function output_delivery_process() {
|
||||
$order_id = absint( $_GET['id'] );
|
||||
|
||||
$has_access = Wiaas_Access_Management::can_current_user_read_order($order_id);
|
||||
|
||||
if (! $has_access) {
|
||||
|
||||
echo "<h2>You don't have permission to view this order.</h2>";
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$order = wc_get_order($order_id);
|
||||
|
||||
if ( !$order ) {
|
||||
|
||||
@@ -22,6 +22,16 @@ class Wiaas_Access_Management {
|
||||
add_action('wiaas_order_item_installation_assigned', array(__CLASS__, 'assign_order_to_installation_organization'), 10, 3);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $order_id
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function can_current_user_read_order($order_id) {
|
||||
|
||||
return Groups_Post_Access::user_can_read_post($order_id);
|
||||
}
|
||||
|
||||
/**
|
||||
* Automatize access control for product and packages
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user