Checking th eupload permission when creating the payment request

This commit is contained in:
ashutosh.nehete 2025-11-06 12:34:51 +05:30
parent 6def4ce361
commit eb9fc5c72a

View File

@ -1641,6 +1641,16 @@ namespace Marco.Pms.Services.Service
try
{
using var scope = _serviceScopeFactory.CreateScope();
var permissionService = scope.ServiceProvider.GetRequiredService<PermissionServices>();
var hasUploadPermission = await permissionService.HasPermission(PermissionsMaster.ExpenseUpload, loggedInEmployee.Id);
if (!hasUploadPermission)
{
_logger.LogWarning("Access DENIED: Employee {EmployeeId} has no permission to create payment requests.", loggedInEmployee.Id);
return ApiResponse<object>.ErrorResponse("Access Denied", "You do not have permission to create any payment request.", 409);
}
// Execute database lookups concurrently
var expenseCategoryTask = Task.Run(async () =>
{