From 42c5879aa04004bfbff932c8fb91fb0287f5ac8c Mon Sep 17 00:00:00 2001 From: Mohaimen Hasan Date: Sun, 8 Nov 2026 11:31:05 +0600 Subject: [PATCH] [AllowAnonymous] removed from Uplaoder API --- .../src/app/_services/Basic/dataUpload.service.ts | 5 +---- .../data-upload/data-upload.component.ts | 2 -- .../charge-sheet/charge-sheet.component.ts | 2 +- .../CommonInterface/DataUploadController.cs | 11 ++++++----- HRM.UI/Controllers/Employee/EmployeeController.cs | 10 +++++----- HRM.UI/Controllers/FileManagerController.cs | 6 +++--- HRM.UI/Controllers/Leave/LeaveController.cs | 8 ++++---- HRM.UI/Controllers/Payroll/TaxController.cs | 2 +- HRM.UI/Controllers/Talent Management/PmpController.cs | 2 +- 9 files changed, 22 insertions(+), 26 deletions(-) diff --git a/HRM.UI/ClientApp/src/app/_services/Basic/dataUpload.service.ts b/HRM.UI/ClientApp/src/app/_services/Basic/dataUpload.service.ts index c0bc484..b04e1e5 100644 --- a/HRM.UI/ClientApp/src/app/_services/Basic/dataUpload.service.ts +++ b/HRM.UI/ClientApp/src/app/_services/Basic/dataUpload.service.ts @@ -16,7 +16,7 @@ export class DataUploadService { const newItemid = this.apiService.getApiDefaultIntData(itemid); return this.apiService.httpGet('/dataUpload/prepareUpload/' + uploadId + '/' + newItemid); } - public uploadFile(selectedFile: File, uploadID: number, payrolltypeid: number, userid: number, itemid?: number, itemidTwo?: number, selectedDate?: Date): + public uploadFile(selectedFile: File, uploadID: number, itemid?: number, itemidTwo?: number, selectedDate?: Date): Observable> { const date = selectedDate.getDate(); const month = selectedDate.getMonth(); @@ -28,10 +28,7 @@ export class DataUploadService { formData.append('uploadID', String(uploadID)); formData.append('itemID', String(itemid)); formData.append('itemIDTwo', String(itemidTwo)); - formData.append('payrolltypeid', String(payrolltypeid)); - formData.append('userid', String(userid)); formData.append('selectedDate', selectedDate.toDateString()); - const req = new HttpRequest('POST', `${this.apiService.base_url + '/'}dataUpload/regularExcelInterface`, formData, { responseType: 'json' }); diff --git a/HRM.UI/ClientApp/src/app/common-interface/data-upload/data-upload.component.ts b/HRM.UI/ClientApp/src/app/common-interface/data-upload/data-upload.component.ts index 4bd44ac..8030ae6 100644 --- a/HRM.UI/ClientApp/src/app/common-interface/data-upload/data-upload.component.ts +++ b/HRM.UI/ClientApp/src/app/common-interface/data-upload/data-upload.component.ts @@ -1109,8 +1109,6 @@ export class DataUploadComponent implements OnInit, OnDestroy { .uploadFile( file, this.type, - this.payrollType.id, - this.user.userID, this.itemid, this.itemidTwo, this.selectedDate diff --git a/HRM.UI/ClientApp/src/app/grievance-management/disciplinary-action/da-master-edit/charge-sheet/charge-sheet.component.ts b/HRM.UI/ClientApp/src/app/grievance-management/disciplinary-action/da-master-edit/charge-sheet/charge-sheet.component.ts index 5f40ac9..082481b 100644 --- a/HRM.UI/ClientApp/src/app/grievance-management/disciplinary-action/da-master-edit/charge-sheet/charge-sheet.component.ts +++ b/HRM.UI/ClientApp/src/app/grievance-management/disciplinary-action/da-master-edit/charge-sheet/charge-sheet.component.ts @@ -54,7 +54,7 @@ export class ChargeSheetComponent implements OnInit { const file: File | null = this.selectedFiles.item(0); this.loadingPanelService.ShowLoadingPanel = true; - this.dataUploadService.uploadFile(file, this.type, null, this.user.userID, this.itemid, undefined, this.selectedDate) + this.dataUploadService.uploadFile(file, this.type, this.itemid, undefined, this.selectedDate) .subscribe( (resp: any) => { this.uploadErrorOrSuccess = resp.body; diff --git a/HRM.UI/Controllers/CommonInterface/DataUploadController.cs b/HRM.UI/Controllers/CommonInterface/DataUploadController.cs index 3ecace1..8731907 100644 --- a/HRM.UI/Controllers/CommonInterface/DataUploadController.cs +++ b/HRM.UI/Controllers/CommonInterface/DataUploadController.cs @@ -76,20 +76,21 @@ namespace HRM.UI.Controllers.Payroll [HttpPost] [Route("regularExcelInterface")] - [AllowAnonymous] + //[AllowAnonymous] public ActionResult regularExcelInterface() { DataUploadColumnDefinition oColumnDefination = new DataUploadColumnDefinition(); RegularDataUploadService regUpload = new RegularDataUploadService(); List errorOrSuccessList = new List(); DateTime selectedDate = DateTime.Today; - try + CurrentUser currentUser = CurrentUser.GetCurrentUser(HttpContext.User); + try { int uploadID = Convert.ToInt32(Request.Form["uploadID"]); int? itemid = GlobalFunctions.GetApiDefaultIntData( Convert.ToString(Request.Form["itemID"])); int? itemidTwo = GlobalFunctions.GetApiDefaultIntData(Convert.ToString(Request.Form["itemIDTwo"])); - int? payrolltypeid = GlobalFunctions.GetApiDefaultIntData(Convert.ToString(Request.Form["payrolltypeid"])); - int? userid = GlobalFunctions.GetApiDefaultIntData(Convert.ToString(Request.Form["userid"])); + int? payrolltypeid = currentUser.PayrollTypeID; + int? userid = (int)currentUser.UserID; string date = Request.Form["selectedDate"]; if (!string.IsNullOrEmpty(date)) { @@ -126,7 +127,7 @@ namespace HRM.UI.Controllers.Payroll [HttpPost] [Route("uploadBonusFile")] - [AllowAnonymous] + //[AllowAnonymous] public ActionResult uploadBonusFile() { DataUploadColumnDefinition oColumnDefination = new DataUploadColumnDefinition(); diff --git a/HRM.UI/Controllers/Employee/EmployeeController.cs b/HRM.UI/Controllers/Employee/EmployeeController.cs index 483d51a..9dd96d8 100644 --- a/HRM.UI/Controllers/Employee/EmployeeController.cs +++ b/HRM.UI/Controllers/Employee/EmployeeController.cs @@ -1664,7 +1664,7 @@ namespace HRM.UI.Controllers } [HttpPost("uploadEmpFile")] - [AllowAnonymous] + //[AllowAnonymous] public ActionResult uploadEmpFile() { empFileupload item = new empFileupload(); @@ -1721,7 +1721,7 @@ namespace HRM.UI.Controllers } [HttpPost("uploadEmpFileInProfileUpdate")] - [AllowAnonymous] + //[AllowAnonymous] public ActionResult UploadEmpFileInProfileUpdate() { empFileupload item = new empFileupload(); @@ -1839,7 +1839,7 @@ namespace HRM.UI.Controllers /// served by UseStaticFiles without auth, so this exposes nothing new. /// [HttpGet("empPhotoFile/{empNo}")] - [AllowAnonymous] + //[AllowAnonymous] public IActionResult GetEmpPhotoFile(string empNo) { string path = new EmployeePhotoService(_env).FindApprovedFile(empNo); @@ -1904,7 +1904,7 @@ namespace HRM.UI.Controllers /// Always revalidated: an approver must never act on a stale image. /// [HttpGet("empPendingPhotoFile/{empNo}")] - [AllowAnonymous] + //[AllowAnonymous] public IActionResult GetEmpPendingPhotoFile(string empNo) { string path = new EmployeePhotoService(_env).FindPendingFilePath(empNo); @@ -3291,7 +3291,7 @@ namespace HRM.UI.Controllers } [HttpPost("uploadEmpFileFromAdmin")] - [AllowAnonymous] + //[AllowAnonymous] public ActionResult uploadEmpFileFromAdmin() { empFileupload item = new empFileupload(); diff --git a/HRM.UI/Controllers/FileManagerController.cs b/HRM.UI/Controllers/FileManagerController.cs index 61eb675..dda5a2a 100644 --- a/HRM.UI/Controllers/FileManagerController.cs +++ b/HRM.UI/Controllers/FileManagerController.cs @@ -77,7 +77,7 @@ namespace HRM.UI.Controllers } [HttpPost("uploadConfigurationfile"), DisableRequestSizeLimit] - [AllowAnonymous] + //[AllowAnonymous] public async Task uploadConfigurationfile() { try @@ -215,7 +215,7 @@ namespace HRM.UI.Controllers [HttpPost("removeExcelfile")] - [AllowAnonymous] + //[AllowAnonymous] public async Task removeExcelfile() { try @@ -269,7 +269,7 @@ namespace HRM.UI.Controllers } [HttpPost("uploadFiles")] - [AllowAnonymous] + //[AllowAnonymous] public async Task UploadFiles() { try diff --git a/HRM.UI/Controllers/Leave/LeaveController.cs b/HRM.UI/Controllers/Leave/LeaveController.cs index bc1d0d1..3147c8f 100644 --- a/HRM.UI/Controllers/Leave/LeaveController.cs +++ b/HRM.UI/Controllers/Leave/LeaveController.cs @@ -1079,7 +1079,7 @@ namespace HRM.UI.Controllers.Leave } [HttpPost("uploadLeaveAttachment")] - [AllowAnonymous] + //[AllowAnonymous] public ActionResult UploadLeaveAttachment() { LeaveAttachment item = new LeaveAttachment(); @@ -2449,7 +2449,7 @@ namespace HRM.UI.Controllers.Leave [HttpPost] [Route("initiateCancelRequest")] - [AllowAnonymous] + //[AllowAnonymous] public ActionResult InitiateCancelRequest(LeaveEntry item) { try @@ -2598,7 +2598,7 @@ namespace HRM.UI.Controllers.Leave [HttpPost] [Route("cancelLeaveApprove")] - [AllowAnonymous] + //[AllowAnonymous] public ActionResult CancelLeaveApprove(WFMovementTran item) { try @@ -2617,7 +2617,7 @@ namespace HRM.UI.Controllers.Leave [HttpPost] [Route("cancelLeaveReject")] - [AllowAnonymous] + //[AllowAnonymous] public ActionResult CancelLeaveReject(WFMovementTran item) { try diff --git a/HRM.UI/Controllers/Payroll/TaxController.cs b/HRM.UI/Controllers/Payroll/TaxController.cs index 5e8e4d0..9599f8c 100644 --- a/HRM.UI/Controllers/Payroll/TaxController.cs +++ b/HRM.UI/Controllers/Payroll/TaxController.cs @@ -2033,7 +2033,7 @@ namespace HRM.UI.Controllers.Payroll } [HttpPost("uploadTaxFile")] - [AllowAnonymous] + //[AllowAnonymous] public ActionResult UploadEmpFile() { TaxReturnAttachment item = new TaxReturnAttachment(); diff --git a/HRM.UI/Controllers/Talent Management/PmpController.cs b/HRM.UI/Controllers/Talent Management/PmpController.cs index 9c02f01..46cab97 100644 --- a/HRM.UI/Controllers/Talent Management/PmpController.cs +++ b/HRM.UI/Controllers/Talent Management/PmpController.cs @@ -2694,7 +2694,7 @@ namespace HRM.UI.Controllers.Talent_Management } [HttpPost("uploadPMSObjectiveProgressHistoryWithAttachment")] - [AllowAnonymous] + //[AllowAnonymous] public ActionResult uploadPMSObjectiveProgressHistoryWithAttachment() { PMSObjectiveProgressAttachment item = new PMSObjectiveProgressAttachment();