From 28be31f84c30b7e49444850285ba47504c23b298 Mon Sep 17 00:00:00 2001 From: SamSys Date: Sun, 5 Jan 2025 17:26:31 +0330 Subject: [PATCH] permissions set --- .../AccountContext.cs | 2 +- .../Pages/Company/Employees/Index.cshtml | 18 ++++---- .../Pages/Company/Employees/Index.cshtml.cs | 46 ++++++------------- .../Pages/Company/Employees/Leave.cshtml | 12 +++-- .../Pages/Company/Employees/Leave.cshtml.cs | 4 +- .../Company/Reports/CheckoutReport.cshtml.cs | 2 + .../Client/Pages/Company/Reports/Index.cshtml | 4 +- .../Pages/Company/Reports/Index.cshtml.cs | 2 + .../Company/RollCall/CameraAccounts.cshtml.cs | 4 +- .../Company/RollCall/CurrentDay.cshtml.cs | 2 + .../RollCall/EmployeeUploadPicture.cshtml.cs | 2 + .../Pages/Company/RollCall/Plans.cshtml.cs | 2 + .../Pages/Company/WorkFlow/Index.cshtml | 10 ++-- .../Pages/Company/WorkFlow/Index.cshtml.cs | 4 +- .../Pages/Company/WorkFlow/RollCall.cshtml.cs | 4 +- .../Pages/Company/Workshop/Index.cshtml | 18 ++++---- .../Pages/Company/Workshop/Index.cshtml.cs | 2 + ServiceHost/Areas/Client/Pages/Index.cshtml | 11 +++-- .../Areas/Client/Pages/Index.cshtml.cs | 42 +++++++++-------- 19 files changed, 106 insertions(+), 85 deletions(-) diff --git a/AccountMangement.Infrastructure.EFCore/AccountContext.cs b/AccountMangement.Infrastructure.EFCore/AccountContext.cs index 28dfdfe1..1719e572 100644 --- a/AccountMangement.Infrastructure.EFCore/AccountContext.cs +++ b/AccountMangement.Infrastructure.EFCore/AccountContext.cs @@ -77,7 +77,7 @@ namespace AccountMangement.Infrastructure.EFCore { var assembly = typeof(AccountMapping).Assembly; modelBuilder.ApplyConfigurationsFromAssembly(assembly); - SubAccountPermissionSeeder.Seed(modelBuilder); + // SubAccountPermissionSeeder.Seed(modelBuilder); base.OnModelCreating(modelBuilder); } } diff --git a/ServiceHost/Areas/Client/Pages/Company/Employees/Index.cshtml b/ServiceHost/Areas/Client/Pages/Company/Employees/Index.cshtml index b08fc622..1efbe808 100644 --- a/ServiceHost/Areas/Client/Pages/Company/Employees/Index.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/Employees/Index.cshtml @@ -1,4 +1,6 @@ @page +@using _0_Framework.Application +@using Microsoft.AspNetCore.Mvc.TagHelpers @using Version = _0_Framework.Application.Version @model ServiceHost.Areas.Client.Pages.Company.Employees.IndexModel @@ -111,7 +113,7 @@
-
+
-
+
-
+
-
+
@@ -180,7 +182,7 @@
-
+ -
+ -
+ -
+
diff --git a/ServiceHost/Areas/Client/Pages/Company/Employees/Index.cshtml.cs b/ServiceHost/Areas/Client/Pages/Company/Employees/Index.cshtml.cs index f8ea53a7..7f8269c3 100644 --- a/ServiceHost/Areas/Client/Pages/Company/Employees/Index.cshtml.cs +++ b/ServiceHost/Areas/Client/Pages/Company/Employees/Index.cshtml.cs @@ -1,41 +1,25 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Security.Claims; -using System.Threading; -using System.Threading.Tasks; -using _0_Framework.Application; -using Company.Domain.CheckoutAgg; -using Company.Domain.ContractAgg; -using Company.Domain.EmployeeAgg; +using _0_Framework.Application; using CompanyManagment.App.Contracts.Checkout; using CompanyManagment.App.Contracts.Contract; using CompanyManagment.App.Contracts.Employee; -using CompanyManagment.App.Contracts.EmployeeChildren; -using CompanyManagment.App.Contracts.Job; using CompanyManagment.App.Contracts.Leave; -using CompanyManagment.App.Contracts.LeftWork; -using CompanyManagment.App.Contracts.LeftWorkInsurance; -using CompanyManagment.App.Contracts.PersonnleCode; using CompanyManagment.App.Contracts.RollCallService; using CompanyManagment.App.Contracts.Workshop; -using CompanyManagment.Application; -using MD.PersianDateTime.Standard; using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.AspNetCore.Mvc.Rendering; -using Microsoft.EntityFrameworkCore.Metadata.Internal; +using System.Security.Claims; +using _0_Framework.Infrastructure; namespace ServiceHost.Areas.Client.Pages.Company.Employees { [Authorize] + [NeedsPermission(SubAccountPermissionHelper.PersonnelOperationsPermissionCode)] public class IndexModel : PageModel { [TempData] public string Message { get; set; } - + // public ConnectedPersonnelViewModel Employees; public PersonnelInfoViewModel Employees; public bool HasEmployees; @@ -52,7 +36,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.Employees public ConnectedPersonnelViewModel ConnectedPersonnel; public string HasCustomizeCheckoutService; - private readonly IWorkshopApplication _workshopApplication; + private readonly IWorkshopApplication _workshopApplication; private readonly IEmployeeApplication _employeeApplication; private readonly IContractApplication _contractApplication; private readonly ICheckoutApplication _checkoutApplication; @@ -106,11 +90,11 @@ namespace ServiceHost.Areas.Client.Pages.Company.Employees HasCustomizeCheckoutService = _rollCallServiceApplication.GetActiveServiceByWorkshopId(id)?.HasCustomizeCheckoutService; - return Page(); + return Page(); } else { - return NotFound(); + return NotFound(); } } @@ -144,7 +128,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.Employees } else { - return NotFound(); + return NotFound(); } } @@ -178,7 +162,7 @@ namespace ServiceHost.Areas.Client.Pages.Company.Employees } else { - return NotFound(); + return NotFound(); } } @@ -403,12 +387,12 @@ namespace ServiceHost.Areas.Client.Pages.Company.Employees public IActionResult OnPostLeaveSave(CreateLeave command) { - var result = _leaveApplication.Create(command); + var result = _leaveApplication.Create(command); - return new JsonResult(new - { - IsSuccedded = result.IsSuccedded, - message = result.Message, + return new JsonResult(new + { + IsSuccedded = result.IsSuccedded, + message = result.Message, printid = result.SendId }); } diff --git a/ServiceHost/Areas/Client/Pages/Company/Employees/Leave.cshtml b/ServiceHost/Areas/Client/Pages/Company/Employees/Leave.cshtml index 078e5748..c33ec523 100644 --- a/ServiceHost/Areas/Client/Pages/Company/Employees/Leave.cshtml +++ b/ServiceHost/Areas/Client/Pages/Company/Employees/Leave.cshtml @@ -1,4 +1,6 @@ @page +@using _0_Framework.Application +@using Microsoft.AspNetCore.Mvc.TagHelpers @using Version = _0_Framework.Application.Version @model ServiceHost.Areas.Client.Pages.Company.Employees.LeaveModel @{ @@ -354,8 +356,8 @@
-
-
-
+
-
-