fix: allow super admins to access all fulfillment work orders
Updated authorization checks in FulfillmentWorkOrderController to bypass business ownership verification for users with super-admin role. This allows platform admins to view and manage work orders across all businesses. Future RBAC enhancements will provide more granular control. Also backfilled seller_business_id for 6 existing orders that were missing this field (created before multi-business checkout was added).
This commit is contained in:
@@ -59,8 +59,8 @@ class FulfillmentWorkOrderController extends Controller
|
||||
{
|
||||
$business = $request->user()->businesses()->first();
|
||||
|
||||
// Ensure work order belongs to seller's business
|
||||
if ($workOrder->order->seller_business_id !== $business->id) {
|
||||
// Ensure work order belongs to seller's business (super admins can access everything)
|
||||
if (! $request->user()->hasRole('super-admin') && $workOrder->order->seller_business_id !== $business->id) {
|
||||
abort(403, 'Unauthorized access to work order');
|
||||
}
|
||||
|
||||
@@ -81,7 +81,8 @@ class FulfillmentWorkOrderController extends Controller
|
||||
|
||||
$business = $request->user()->businesses()->first();
|
||||
|
||||
if ($workOrder->order->seller_business_id !== $business->id) {
|
||||
// Verify authorization (super admins can access everything)
|
||||
if (! $request->user()->hasRole('super-admin') && $workOrder->order->seller_business_id !== $business->id) {
|
||||
abort(403);
|
||||
}
|
||||
|
||||
@@ -102,8 +103,8 @@ class FulfillmentWorkOrderController extends Controller
|
||||
{
|
||||
$business = $request->user()->businesses()->first();
|
||||
|
||||
// Verify authorization
|
||||
if ($workOrder->order->seller_business_id !== $business->id) {
|
||||
// Verify authorization (super admins can access everything)
|
||||
if (! $request->user()->hasRole('super-admin') && $workOrder->order->seller_business_id !== $business->id) {
|
||||
abort(403, 'Unauthorized access to work order');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user