Add Directory Management Feature with Permission Handling
This commit is contained in:
parent
2a0adc75c4
commit
10322fa432
@ -480,16 +480,14 @@ namespace Marco.Pms.DataAccess.Data
|
||||
modelBuilder.Entity<Feature>().HasData(
|
||||
new Feature { Id = new Guid("53176ebf-c75d-42e5-839f-4508ffac3def"), Description = "Manage Project", Name = "Manage Project", ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), IsActive = true },
|
||||
new Feature { Id = new Guid("9666de86-d7c7-4d3d-acaa-fcd6d6b81f3c"), Description = "Manage Infra", Name = "Manage Infra", ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), IsActive = true },
|
||||
|
||||
new Feature { Id = new Guid("9d4b5489-2079-40b9-bd77-6e1bf90bc19f"), Description = "Manage Tasks", Name = "Task Management", ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), IsActive = true },
|
||||
|
||||
//new Feature { Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), Description = "Assign and Update Tasks Progress", Name = "Assign and Update Tasks Progress", ModuleId = new Guid("bf59fd88-b57a-4d67-bf01-3780f385896b"), IsActive = true },
|
||||
|
||||
|
||||
new Feature { Id = new Guid("81ab8a87-8ccd-4015-a917-0627cee6a100"), Description = "Manage Employee", Name = "Employee Management", ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), IsActive = true },
|
||||
new Feature { Id = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), Description = "Attendance", Name = "Attendance", ModuleId = new Guid("2a231490-bcb1-4bdd-91f1-f25fb7f25b23"), IsActive = true },
|
||||
|
||||
new Feature { Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), Description = "Global Masters", Name = "Global Masters", ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), IsActive = true }
|
||||
new Feature { Id = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), Description = "Global Masters", Name = "Global Masters", ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), IsActive = true },
|
||||
new Feature { Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), Description = "Managing all directory related rights", Name = "Directory Management", ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), IsActive = true }
|
||||
|
||||
//new Feature { Id = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), Description = "Tenant Masters", Name = "Tenant Masters", ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), IsActive = true }
|
||||
);
|
||||
|
||||
@ -518,8 +516,11 @@ namespace Marco.Pms.DataAccess.Data
|
||||
new FeaturePermission { Id = new Guid("ccb0589f-712b-43de-92ed-5b6088e7dc4e"), FeatureId = new Guid("52c9cf54-1eb2-44d2-81bb-524cf29c0a94"), IsEnabled = true, Name = "Self Attendance", Description = "Team Attendance refers to tracking and managing the attendance of all team members collectively, often monitored by a team lead or manager." },
|
||||
|
||||
new FeaturePermission { Id = new Guid("5ffbafe0-7ab0-48b1-bb50-c1bf76b65f9d"), FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), IsEnabled = true, Name = "View Masters", Description = "Grants a user read-only access to foundational or reference data within the system. \"Masters\" typically refer to predefined lists, categories, or templates that are used throughout the application to standardize information and maintain consistency" },
|
||||
new FeaturePermission { Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), IsEnabled = true, Name = "Manage Masters", Description = "Grants a user the authority to create, modify, and delete foundational or reference data within the system. These \"masters\" are typically the core lists, categories, and configurations that other data and functionalities rely upon, such as departments, job titles, product categories" }
|
||||
//new FeaturePermission { Id = new Guid("cb8ec407-46d4-4467-930c-69127cda6dec"), FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), IsEnabled = true, Name = "View Masters", Description = "" },
|
||||
new FeaturePermission { Id = new Guid("588a8824-f924-4955-82d8-fc51956cf323"), FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"), IsEnabled = true, Name = "Manage Masters", Description = "Grants a user the authority to create, modify, and delete foundational or reference data within the system. These \"masters\" are typically the core lists, categories, and configurations that other data and functionalities rely upon, such as departments, job titles, product categories" },
|
||||
|
||||
new FeaturePermission { Id = new Guid("4286a13b-bb40-4879-8c6d-18e9e393beda"), FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), IsEnabled = true, Name = "Directory Admin", Description = "Full control over all directories, including the ability to manage permissions for all directories in the system." },
|
||||
new FeaturePermission { Id = new Guid("62668630-13ce-4f52-a0f0-db38af2230c5"), FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), IsEnabled = true, Name = "Directory Manager", Description = "Full control over directories they created or have been assigned. Can also manage permissions for those directories." },
|
||||
new FeaturePermission { Id = new Guid("0f919170-92d4-4337-abd3-49b66fc871bb"), FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), IsEnabled = true, Name = "Directory User", Description = "Full control over directories they created. Can view contacts in directories they either created or were assigned to. Can manage permissions only for directories they created." }
|
||||
//new FeaturePermission { Id = new Guid("6b1a6d97-a951-4de5-9b19-709bac7c4f18"), FeatureId = new Guid("660131a4-788c-4739-a082-cbbf7879cbf2"), IsEnabled = true, Name = "Manage Masters", Description = "" }
|
||||
|
||||
);
|
||||
|
3055
Marco.Pms.DataAccess/Migrations/20250524074333_Added_Feature_Directory_Management.Designer.cs
generated
Normal file
3055
Marco.Pms.DataAccess/Migrations/20250524074333_Added_Feature_Directory_Management.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,100 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional
|
||||
|
||||
namespace Marco.Pms.DataAccess.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Added_Feature_Directory_Management : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.AddColumn<DateTime>(
|
||||
name: "CreatedAt",
|
||||
table: "Buckets",
|
||||
type: "datetime(6)",
|
||||
nullable: false,
|
||||
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
|
||||
|
||||
migrationBuilder.AddColumn<Guid>(
|
||||
name: "CreatedByID",
|
||||
table: "Buckets",
|
||||
type: "char(36)",
|
||||
nullable: false,
|
||||
defaultValue: new Guid("00000000-0000-0000-0000-000000000000"),
|
||||
collation: "ascii_general_ci");
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "Features",
|
||||
columns: new[] { "Id", "Description", "IsActive", "ModuleId", "Name" },
|
||||
values: new object[] { new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), "Managing all directory related rights", true, new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"), "Directory Management" });
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "FeaturePermissions",
|
||||
columns: new[] { "Id", "Description", "FeatureId", "IsEnabled", "Name" },
|
||||
values: new object[,]
|
||||
{
|
||||
{ new Guid("0f919170-92d4-4337-abd3-49b66fc871bb"), "Full control over directories they created. Can view contacts in directories they either created or were assigned to. Can manage permissions only for directories they created.", new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), true, "Directory User" },
|
||||
{ new Guid("4286a13b-bb40-4879-8c6d-18e9e393beda"), "Full control over all directories, including the ability to manage permissions for all directories in the system.", new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), true, "Directory Admin" },
|
||||
{ new Guid("62668630-13ce-4f52-a0f0-db38af2230c5"), "Full control over directories they created or have been assigned. Can also manage permissions for those directories.", new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"), true, "Directory Manager" }
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Buckets_CreatedByID",
|
||||
table: "Buckets",
|
||||
column: "CreatedByID");
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
name: "FK_Buckets_Employees_CreatedByID",
|
||||
table: "Buckets",
|
||||
column: "CreatedByID",
|
||||
principalTable: "Employees",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropForeignKey(
|
||||
name: "FK_Buckets_Employees_CreatedByID",
|
||||
table: "Buckets");
|
||||
|
||||
migrationBuilder.DropIndex(
|
||||
name: "IX_Buckets_CreatedByID",
|
||||
table: "Buckets");
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("0f919170-92d4-4337-abd3-49b66fc871bb"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("4286a13b-bb40-4879-8c6d-18e9e393beda"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "FeaturePermissions",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("62668630-13ce-4f52-a0f0-db38af2230c5"));
|
||||
|
||||
migrationBuilder.DeleteData(
|
||||
table: "Features",
|
||||
keyColumn: "Id",
|
||||
keyValue: new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"));
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CreatedAt",
|
||||
table: "Buckets");
|
||||
|
||||
migrationBuilder.DropColumn(
|
||||
name: "CreatedByID",
|
||||
table: "Buckets");
|
||||
}
|
||||
}
|
||||
}
|
@ -331,6 +331,12 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<DateTime>("CreatedAt")
|
||||
.HasColumnType("datetime(6)");
|
||||
|
||||
b.Property<Guid>("CreatedByID")
|
||||
.HasColumnType("char(36)");
|
||||
|
||||
b.Property<string>("Description")
|
||||
.IsRequired()
|
||||
.HasColumnType("longtext");
|
||||
@ -344,6 +350,8 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("CreatedByID");
|
||||
|
||||
b.HasIndex("TenantId");
|
||||
|
||||
b.ToTable("Buckets");
|
||||
@ -1031,6 +1039,30 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
FeatureId = new Guid("be3b3afc-6ccf-4566-b9b6-aafcb65546be"),
|
||||
IsEnabled = true,
|
||||
Name = "Manage Masters"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("4286a13b-bb40-4879-8c6d-18e9e393beda"),
|
||||
Description = "Full control over all directories, including the ability to manage permissions for all directories in the system.",
|
||||
FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"),
|
||||
IsEnabled = true,
|
||||
Name = "Directory Admin"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("62668630-13ce-4f52-a0f0-db38af2230c5"),
|
||||
Description = "Full control over directories they created or have been assigned. Can also manage permissions for those directories.",
|
||||
FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"),
|
||||
IsEnabled = true,
|
||||
Name = "Directory Manager"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("0f919170-92d4-4337-abd3-49b66fc871bb"),
|
||||
Description = "Full control over directories they created. Can view contacts in directories they either created or were assigned to. Can manage permissions only for directories they created.",
|
||||
FeatureId = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"),
|
||||
IsEnabled = true,
|
||||
Name = "Directory User"
|
||||
});
|
||||
});
|
||||
|
||||
@ -1466,6 +1498,14 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
IsActive = true,
|
||||
ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"),
|
||||
Name = "Global Masters"
|
||||
},
|
||||
new
|
||||
{
|
||||
Id = new Guid("39e66f81-efc6-446c-95bd-46bff6cfb606"),
|
||||
Description = "Managing all directory related rights",
|
||||
IsActive = true,
|
||||
ModuleId = new Guid("c43db8c7-ab73-47f4-9d3b-f83e81357924"),
|
||||
Name = "Directory Management"
|
||||
});
|
||||
});
|
||||
|
||||
@ -2540,12 +2580,20 @@ namespace Marco.Pms.DataAccess.Migrations
|
||||
|
||||
modelBuilder.Entity("Marco.Pms.Model.Directory.Bucket", b =>
|
||||
{
|
||||
b.HasOne("Marco.Pms.Model.Employees.Employee", "CreatedBy")
|
||||
.WithMany()
|
||||
.HasForeignKey("CreatedByID")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("Marco.Pms.Model.Entitlements.Tenant", "Tenant")
|
||||
.WithMany()
|
||||
.HasForeignKey("TenantId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("CreatedBy");
|
||||
|
||||
b.Navigation("Tenant");
|
||||
});
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Marco.Pms.Model.Utilities;
|
||||
using Marco.Pms.Model.Employees;
|
||||
using Marco.Pms.Model.Utilities;
|
||||
|
||||
namespace Marco.Pms.Model.Directory
|
||||
{
|
||||
@ -6,6 +7,9 @@ namespace Marco.Pms.Model.Directory
|
||||
{
|
||||
public Guid Id { get; set; }
|
||||
public string Name { get; set; } = string.Empty;
|
||||
public Guid CreatedByID { get; set; }
|
||||
public Employee? CreatedBy { get; set; }
|
||||
public DateTime CreatedAt { get; set; } = DateTime.UtcNow;
|
||||
public string Description { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
@ -1017,6 +1017,8 @@ namespace Marco.Pms.Services.Helpers
|
||||
{
|
||||
Name = bucketDto.Name,
|
||||
Description = bucketDto.Description,
|
||||
CreatedAt = DateTime.UtcNow,
|
||||
CreatedByID = LoggedInEmployee.Id,
|
||||
TenantId = tenantId
|
||||
};
|
||||
_context.Buckets.Add(bucket);
|
||||
|
Loading…
x
Reference in New Issue
Block a user