diff --git a/Marco.Pms.Services/Controllers/RolesController.cs b/Marco.Pms.Services/Controllers/RolesController.cs index 800e7a2..11faa6f 100644 --- a/Marco.Pms.Services/Controllers/RolesController.cs +++ b/Marco.Pms.Services/Controllers/RolesController.cs @@ -171,6 +171,13 @@ namespace MarcoBMS.Services.Controllers { return BadRequest(new { Message = "Feature Permission is required." }); } + + bool roleExists = _context.ApplicationRoles + .Any(r => r.TenantId == TenantId && r.Role.ToLower() == createRoleDto.Role.ToLower());// assuming role name is unique per tenant + if (roleExists) + { + return BadRequest(new {message = "Role already exists." }); + } ApplicationRole role = createRoleDto.ToApplicationRoleFromCreateDto(TenantId); _context.ApplicationRoles.Add(role); @@ -198,6 +205,7 @@ namespace MarcoBMS.Services.Controllers if (id != updateRoleDto.Id.ToString()) return BadRequest("Role ID mismatch"); + try { int TenantId = GetTenantId(); diff --git a/Marco.Pms.Services/appsettings.json b/Marco.Pms.Services/appsettings.json index bf639e3..c10eaa4 100644 --- a/Marco.Pms.Services/appsettings.json +++ b/Marco.Pms.Services/appsettings.json @@ -7,8 +7,17 @@ }, "ConnectionStrings": { // "DefaultConnectionString": "Server=103.50.160.45;User ID=marcowvh_admin;Password=Marcoemp@123;Database=marcowvh_empattendanceci", +<<<<<<< Updated upstream //"DefaultConnectionString": "Server=localhost;port=3333;User ID=root;Password=root;Database=MarcoBMS1", "DefaultConnectionString": "Server=147.93.98.152;User ID=root;Password=MySqlUser@123$;Database=MarcoBMS1" +======= + "DefaultConnectionString": "Server=localhost;port=3306;User ID=root;Password=root;Database=MarcoBMS1", + //"DefaultConnectionString": "Server=147.93.98.152;User ID=devuser;Password=AppUser@123$;Database=MarcoBMS1" + }, + "AppSettings": { + "WebFrontendUrl": "http://localhost:5173", + "ImagesBaseUrl": "http://localhost:5173" +>>>>>>> Stashed changes }, "AllowedHosts": "*", "Jwt": {