Skip to content

Keep vendors, store managers and sales managers out of the admin API - #1089

Merged
KrzysztofPajak merged 1 commit into
developfrom
fix/api-sales-manager
Nov 23, 2026
Merged

KrzysztofPajak merged 1 commit into
developfrom
fix/api-sales-manager

Conversation

@KrzysztofPajak

Copy link
Copy Markdown
Member

The admin API works on all data. The admin panel turns away vendors and store managers, and lets a sales manager see only the customers and orders of their sales employee. The API filter checked only the admin panel permission, so these roles reached every record through the API.

Changes

  • AuthorizeApiAdminAttribute: a vendor (group or vendor account), a store manager (group or staff store) and a sales manager get 403, the same roles the admin panel turns away. The API has no sales employee scope, so a sales manager is turned away even with a sales employee assigned.

Tests

  • AuthorizeApiAdminAttributeTests: five new cases, one per role marker.
  • Grand.Module.Api.Tests (115) pass.

The admin API works on all data. The admin panel already turns away vendors and store managers, and admits a sales manager only to the customers and orders of their sales employee. The API filter checked only the admin panel permission, so these roles reached every record through it.

The filter now turns them away the same way. The API has no sales employee scope, so a sales manager is turned away whether or not a sales employee is assigned.
Copilot AI balanced review requested due to automatic review settings November 22, 2026 19:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.


//the API works on all data, so the scoped panel roles stay out, as they do in the admin panel;
//a sales manager is turned away too, because the API has no sales employee scope
if (await groupService.IsVendor(customer) || !string.IsNullOrEmpty(customer.VendorId) ||
@KrzysztofPajak
KrzysztofPajak merged commit 9e6b431 into develop Nov 23, 2026
9 checks passed
@KrzysztofPajak
KrzysztofPajak deleted the fix/api-sales-manager branch November 23, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants