Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VCST-1754: Add missing authorization to some endpoints #431

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,12 @@ public async Task<ActionResult> GetInvoicePdf(string orderNumber)
throw new InvalidOperationException($"Cannot find order with number {orderNumber}");
}

var authorizationResult = await _authorizationService.AuthorizeAsync(User, order, new OrderAuthorizationRequirement(ModuleConstants.Security.Permissions.Read));
if (!authorizationResult.Succeeded)
{
return Forbid();
}

var notification = await _notificationSearchService.GetNotificationAsync<InvoiceEmailNotification>(new TenantIdentity(order.StoreId, nameof(Store)));
notification.CustomerOrder = order;
notification.LanguageCode = order.LanguageCode;
Expand Down Expand Up @@ -718,6 +724,12 @@ public ActionResult GetOrderFullTextSearchEnabled()
[Route("indexed/search")]
public async Task<ActionResult<CustomerOrderSearchResult>> SearchCustomerOrderIndexed([FromBody] CustomerOrderIndexedSearchCriteria criteria)
{
var authorizationResult = await _authorizationService.AuthorizeAsync(User, criteria, new OrderAuthorizationRequirement(ModuleConstants.Security.Permissions.Read));
if (!authorizationResult.Succeeded)
{
return Forbid();
}

var result = await _indexedSearchService.SearchCustomerOrdersAsync(criteria);
return Content(JsonConvert.SerializeObject(result, _outputJsonSerializerSettings), "application/json");
}
Expand Down
Loading