Chnaged the name of view employee feature permission to view team members
This commit is contained in:
parent
5f9ca98284
commit
a3de905159
@ -538,8 +538,8 @@ namespace Marco.Pms.DataAccess.Data
|
|||||||
new FeaturePermission { Id = new Guid("db4e40c5-2ba9-4b6d-b8a6-a16a250ff99c"), FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), IsEnabled = true, Name = "Approve Task", Description = "Grants a user the authority to officially confirm the completion or acceptance of a task, often signifying that it meets the required standards or criteria" },
|
new FeaturePermission { Id = new Guid("db4e40c5-2ba9-4b6d-b8a6-a16a250ff99c"), FeatureId = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), IsEnabled = true, Name = "Approve Task", Description = "Grants a user the authority to officially confirm the completion or acceptance of a task, often signifying that it meets the required standards or criteria" },
|
||||||
|
|
||||||
|
|
||||||
new FeaturePermission { Id = new Guid("60611762-7f8a-4fb5-b53f-b1139918796b"), FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), IsEnabled = true, Name = "View All Employee", Description = "Grants a user read-only access to details about the all individuals within the system. This typically includes names, contact information, roles, departments, and potentially other relevant employee data" },
|
new FeaturePermission { Id = new Guid("60611762-7f8a-4fb5-b53f-b1139918796b"), FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), IsEnabled = true, Name = "View All Employees", Description = "Grants a user read-only access to details about the all individuals within the system. This typically includes names, contact information, roles, departments, and potentially other relevant employee data" },
|
||||||
new FeaturePermission { Id = new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), IsEnabled = true, Name = "View Employee", Description = "Grants a user read-only access to details about the individuals within the system which are is assigned to same projects as user. This typically includes names, contact information, roles, departments, and potentially other relevant employee data" },
|
new FeaturePermission { Id = new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"), FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), IsEnabled = true, Name = "View Team Members", Description = "Grants a user read-only access to details about the individuals within the system which are is assigned to same projects as user. This typically includes names, contact information, roles, departments, and potentially other relevant employee data" },
|
||||||
new FeaturePermission { Id = new Guid("a97d366a-c2bb-448d-be93-402bd2324566"), FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), IsEnabled = true, Name = "Add/Edit Employee", Description = "Grants a user the authority to create new employee profiles and modify existing employee details within the system. This typically includes adding or updating information such as names, contact details, roles, departments, skills, and potentially other personal or professional data" },
|
new FeaturePermission { Id = new Guid("a97d366a-c2bb-448d-be93-402bd2324566"), FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), IsEnabled = true, Name = "Add/Edit Employee", Description = "Grants a user the authority to create new employee profiles and modify existing employee details within the system. This typically includes adding or updating information such as names, contact details, roles, departments, skills, and potentially other personal or professional data" },
|
||||||
new FeaturePermission { Id = new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"), FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), IsEnabled = true, Name = "Assign Roles", Description = "Grants a user the authority to manage employee application roles, enabling them to assign or revoke access privileges within the system." },
|
new FeaturePermission { Id = new Guid("fbd213e0-0250-46f1-9f5f-4b2a1e6e76a3"), FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), IsEnabled = true, Name = "Assign Roles", Description = "Grants a user the authority to manage employee application roles, enabling them to assign or revoke access privileges within the system." },
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,47 @@
|
|||||||
|
using System;
|
||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace Marco.Pms.DataAccess.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class Changed_Name_Of_Feature_Permission_To_ViewTeamMembers : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "FeaturePermissions",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: new Guid("60611762-7f8a-4fb5-b53f-b1139918796b"),
|
||||||
|
column: "Name",
|
||||||
|
value: "View All Employees");
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "FeaturePermissions",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"),
|
||||||
|
column: "Name",
|
||||||
|
value: "View Team Members");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "FeaturePermissions",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: new Guid("60611762-7f8a-4fb5-b53f-b1139918796b"),
|
||||||
|
column: "Name",
|
||||||
|
value: "View All Employee");
|
||||||
|
|
||||||
|
migrationBuilder.UpdateData(
|
||||||
|
table: "FeaturePermissions",
|
||||||
|
keyColumn: "Id",
|
||||||
|
keyValue: new Guid("b82d2b7e-0d52-45f3-997b-c008ea460e7f"),
|
||||||
|
column: "Name",
|
||||||
|
value: "View Employee");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1039,7 +1039,7 @@ namespace Marco.Pms.DataAccess.Migrations
|
|||||||
Description = "Grants a user read-only access to details about the all individuals within the system. This typically includes names, contact information, roles, departments, and potentially other relevant employee data",
|
Description = "Grants a user read-only access to details about the all individuals within the system. This typically includes names, contact information, roles, departments, and potentially other relevant employee data",
|
||||||
FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"),
|
FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"),
|
||||||
IsEnabled = true,
|
IsEnabled = true,
|
||||||
Name = "View All Employee"
|
Name = "View All Employees"
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
@ -1047,7 +1047,7 @@ namespace Marco.Pms.DataAccess.Migrations
|
|||||||
Description = "Grants a user read-only access to details about the individuals within the system which are is assigned to same projects as user. This typically includes names, contact information, roles, departments, and potentially other relevant employee data",
|
Description = "Grants a user read-only access to details about the individuals within the system which are is assigned to same projects as user. This typically includes names, contact information, roles, departments, and potentially other relevant employee data",
|
||||||
FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"),
|
FeatureId = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"),
|
||||||
IsEnabled = true,
|
IsEnabled = true,
|
||||||
Name = "View Employee"
|
Name = "View Team Members"
|
||||||
},
|
},
|
||||||
new
|
new
|
||||||
{
|
{
|
||||||
|
@ -38,8 +38,8 @@ namespace MarcoBMS.Services.Controllers
|
|||||||
private readonly IHubContext<MarcoHub> _signalR;
|
private readonly IHubContext<MarcoHub> _signalR;
|
||||||
private readonly PermissionServices _permission;
|
private readonly PermissionServices _permission;
|
||||||
private readonly ProjectsHelper _projectsHelper;
|
private readonly ProjectsHelper _projectsHelper;
|
||||||
private readonly Guid ViewAllEmployee;
|
private readonly Guid ViewAllEmployees;
|
||||||
private readonly Guid ViewEmployee;
|
private readonly Guid ViewTeamMembers;
|
||||||
private readonly Guid tenantId;
|
private readonly Guid tenantId;
|
||||||
|
|
||||||
|
|
||||||
@ -56,8 +56,8 @@ namespace MarcoBMS.Services.Controllers
|
|||||||
_logger = logger;
|
_logger = logger;
|
||||||
_signalR = signalR;
|
_signalR = signalR;
|
||||||
_permission = permission;
|
_permission = permission;
|
||||||
ViewAllEmployee = Guid.Parse("60611762-7f8a-4fb5-b53f-b1139918796b");
|
ViewAllEmployees = Guid.Parse("60611762-7f8a-4fb5-b53f-b1139918796b");
|
||||||
ViewEmployee = Guid.Parse("b82d2b7e-0d52-45f3-997b-c008ea460e7f");
|
ViewTeamMembers = Guid.Parse("b82d2b7e-0d52-45f3-997b-c008ea460e7f");
|
||||||
_projectsHelper = projectsHelper;
|
_projectsHelper = projectsHelper;
|
||||||
tenantId = _userHelper.GetTenantId();
|
tenantId = _userHelper.GetTenantId();
|
||||||
}
|
}
|
||||||
@ -126,18 +126,18 @@ namespace MarcoBMS.Services.Controllers
|
|||||||
List<Project> projects = await _projectsHelper.GetMyProjects(tenantId, loggedInEmployee);
|
List<Project> projects = await _projectsHelper.GetMyProjects(tenantId, loggedInEmployee);
|
||||||
var projectIds = projects.Select(p => p.Id).ToList();
|
var projectIds = projects.Select(p => p.Id).ToList();
|
||||||
|
|
||||||
var hasViewAllEmployeePermission = await _permission.HasPermission(ViewAllEmployee, loggedInEmployee.Id);
|
var hasViewAllEmployeesPermission = await _permission.HasPermission(ViewAllEmployees, loggedInEmployee.Id);
|
||||||
var hasViewEmployeePermission = await _permission.HasPermission(ViewEmployee, loggedInEmployee.Id);
|
var hasViewTeamMembersPermission = await _permission.HasPermission(ViewTeamMembers, loggedInEmployee.Id);
|
||||||
|
|
||||||
List<EmployeeVM> result = new();
|
List<EmployeeVM> result = new();
|
||||||
|
|
||||||
// Step 4: Determine access level and fetch employees accordingly
|
// Step 4: Determine access level and fetch employees accordingly
|
||||||
if (hasViewAllEmployeePermission || projectid != null)
|
if (hasViewAllEmployeesPermission || projectid != null)
|
||||||
{
|
{
|
||||||
result = await _employeeHelper.GetEmployeeByProjectId(tenantId, projectid, ShowInactive);
|
result = await _employeeHelper.GetEmployeeByProjectId(tenantId, projectid, ShowInactive);
|
||||||
_logger.LogInfo("Employee list fetched using full access or specific project.");
|
_logger.LogInfo("Employee list fetched using full access or specific project.");
|
||||||
}
|
}
|
||||||
else if (hasViewEmployeePermission && !ShowInactive)
|
else if (hasViewTeamMembersPermission && !ShowInactive)
|
||||||
{
|
{
|
||||||
var employeeIds = await _context.ProjectAllocations
|
var employeeIds = await _context.ProjectAllocations
|
||||||
.Where(pa => projectIds.Contains(pa.ProjectId) && pa.IsActive)
|
.Where(pa => projectIds.Contains(pa.ProjectId) && pa.IsActive)
|
||||||
|
@ -33,7 +33,7 @@ namespace MarcoBMS.Services.Controllers
|
|||||||
features.Add(item);
|
features.Add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return features;
|
return features.OrderBy(f => f.Name).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpGet]
|
[HttpGet]
|
||||||
@ -50,7 +50,7 @@ namespace MarcoBMS.Services.Controllers
|
|||||||
ModuleId = c.ModuleId,
|
ModuleId = c.ModuleId,
|
||||||
ModuleName = c.Module != null ? c.Module.Name : string.Empty,
|
ModuleName = c.Module != null ? c.Module.Name : string.Empty,
|
||||||
IsActive = c.IsActive
|
IsActive = c.IsActive
|
||||||
});
|
}).OrderBy(f => f.Name).ToList();
|
||||||
return Ok(ApiResponse<object>.SuccessResponse(rolesVM, "Success.", 200));
|
return Ok(ApiResponse<object>.SuccessResponse(rolesVM, "Success.", 200));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -156,6 +156,7 @@ namespace MarcoBMS.Services.Controllers
|
|||||||
RoleName = x.Role.Role,
|
RoleName = x.Role.Role,
|
||||||
FeaturePermission = x.FeaturePermission
|
FeaturePermission = x.FeaturePermission
|
||||||
})
|
})
|
||||||
|
.OrderByDescending(r => r.RoleName)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
|
||||||
List<ApplicationRolesVM> applicationRoles = new List<ApplicationRolesVM>();
|
List<ApplicationRolesVM> applicationRoles = new List<ApplicationRolesVM>();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user