feat: add user and role view sheets with detailed information display

- Created UserViewSheet component to display user details including username, full name, role, status, and timestamps.
- Created RoleViewSheet component to display role details including name, level, status, creation date, and associated permissions.
- Introduced permissions configuration in a new permissions.ts file, defining categories and permission codes for better management.
- Implemented middleware for authentication, ensuring access control for protected routes.
This commit is contained in:
Kalana B. Thilakarathna
2026-10-18 23:11:01 +05:30
parent 558afc6f9d
commit 0052725b88
86 changed files with 41117 additions and 939 deletions
@@ -1,4 +1,5 @@
using Distribution.Data;
using Distribution.Models;
using Microsoft.EntityFrameworkCore;
namespace Distribution.Features.Role;
@@ -16,4 +17,29 @@ public class RoleRepository(AppDBContext context) : IRoleRepository
.Include(rp => rp.Permission)
.Where(rp => rp.FK_RoleId == roleId && rp.IsActive)
.ToListAsync();
public async Task AddAsync(Models.Role role) =>
await context.Roles.AddAsync(role);
public void Update(Models.Role role) =>
context.Roles.Update(role);
public void Remove(Models.Role role)
{
role.IsActive = false;
context.Roles.Update(role);
}
public async Task ReplacePermissionsAsync(Guid roleId, List<Guid> permissionIds)
{
var existing = await context.RolePermissions
.Where(rp => rp.FK_RoleId == roleId)
.ToListAsync();
context.RolePermissions.RemoveRange(existing);
context.RolePermissions.AddRange(permissionIds.Select(pid => new RolePermission
{
FK_RoleId = roleId,
FK_PermissionId = pid
}));
}
}