Compare commits
10 Commits
bugfix/adj
...
2bab87fe8d
| Author | SHA1 | Date | |
|---|---|---|---|
| 2bab87fe8d | |||
| cd613cb5b8 | |||
| 39b415065a | |||
|
|
75962160af | ||
| 0f67d57bed | |||
| b3dec4a601 | |||
| 63173eac5a | |||
| d36e24cfbf | |||
| a2a2b6ef8d | |||
| 32131d032b |
@@ -7,7 +7,6 @@
|
||||
using Asp.Versioning;
|
||||
using Core.Thalos.BuildingBlocks;
|
||||
using Core.Thalos.Provider.Contracts;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using ModuleRequest = Core.Thalos.Domain.Contexts.Onboarding.Request.ModuleRequest;
|
||||
using StatusEnum = Core.Blueprint.Mongo.StatusEnum;
|
||||
@@ -22,7 +21,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
[Produces(MimeTypes.ApplicationJson)]
|
||||
[Consumes(MimeTypes.ApplicationJson)]
|
||||
[ApiController]
|
||||
[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
|
||||
//[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
|
||||
public class ModuleController(IModuleProvider service) : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
@@ -30,7 +29,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
/// </summary>
|
||||
[HttpGet]
|
||||
[ProducesResponseType(typeof(IEnumerable<ModuleAdapter>), StatusCodes.Status200OK)]
|
||||
[Permission("ModuleManagement.Read, RoleManagement.Read")]
|
||||
//[Permission("ModuleManagement.Read, RoleManagement.Read")]
|
||||
public async Task<IActionResult> GetAllModulesAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await service.GetAllModules(cancellationToken);
|
||||
@@ -43,7 +42,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
[HttpPost]
|
||||
[Route(Routes.GetModuleList)]
|
||||
[ProducesResponseType(typeof(IEnumerable<ModuleAdapter>), StatusCodes.Status200OK)]
|
||||
[Permission("ModuleManagement.Read")]
|
||||
//[Permission("ModuleManagement.Read")]
|
||||
public async Task<IActionResult> GetAllModulesByList([FromBody] string[] modules, CancellationToken cancellationToken)
|
||||
{
|
||||
if (modules == null || !modules.Any())
|
||||
@@ -60,7 +59,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
[Route(Routes.Id)]
|
||||
[ProducesResponseType(typeof(ModuleAdapter), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
[Permission("ModuleManagement.Read")]
|
||||
//[Permission("ModuleManagement.Read")]
|
||||
public async Task<IActionResult> GetModuleByIdAsync([FromRoute] string _id, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await service.GetModuleById(_id, cancellationToken);
|
||||
@@ -77,7 +76,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
[HttpPost]
|
||||
[ProducesResponseType(typeof(ModuleAdapter), StatusCodes.Status201Created)]
|
||||
[ProducesResponseType(StatusCodes.Status422UnprocessableEntity)]
|
||||
[Permission("ModuleManagement.Write")]
|
||||
//[Permission("ModuleManagement.Write")]
|
||||
public async Task<IActionResult> CreateModuleAsync([FromBody] ModuleRequest newModule, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await service.CreateModule(newModule, cancellationToken);
|
||||
@@ -92,7 +91,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
[ProducesResponseType(typeof(ModuleAdapter), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||
[ProducesResponseType(StatusCodes.Status422UnprocessableEntity)]
|
||||
[Permission("ModuleManagement.Write")]
|
||||
//[Permission("ModuleManagement.Write")]
|
||||
public async Task<IActionResult> UpdateModuleAsync([FromRoute] string _id, [FromBody] ModuleAdapter entity, CancellationToken cancellationToken)
|
||||
{
|
||||
if (_id != entity._Id)
|
||||
@@ -108,7 +107,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
[HttpPatch]
|
||||
[Route(Routes.ChangeStatus)]
|
||||
[ProducesResponseType(typeof(ModuleAdapter), StatusCodes.Status200OK)]
|
||||
[Permission("ModuleManagement.Write")]
|
||||
//[Permission("ModuleManagement.Write")]
|
||||
public async Task<IActionResult> ChangeModuleStatus([FromRoute] string _id, [FromRoute] StatusEnum newStatus, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await service.ChangeModuleStatus(_id, newStatus, cancellationToken);
|
||||
@@ -132,7 +131,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
[Route(Routes.Id)]
|
||||
[ProducesResponseType(typeof(ModuleAdapter), StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
[Permission("ModuleManagement.Write")]
|
||||
//[Permission("ModuleManagement.Write")]
|
||||
public async Task<IActionResult> DeleteModuleAsync([FromRoute] string _id, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await service.DeleteModule(_id, cancellationToken);
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
[Produces(MimeTypes.ApplicationJson)]
|
||||
[Consumes(MimeTypes.ApplicationJson)]
|
||||
[ApiController]
|
||||
[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
|
||||
//[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
|
||||
public class PermissionController(IPermissionProvider service) : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
@@ -36,7 +36,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
[Consumes(MimeTypes.ApplicationJson)]
|
||||
[Produces(MimeTypes.ApplicationJson)]
|
||||
[ProducesResponseType(typeof(IEnumerable<PermissionAdapter>), StatusCodes.Status200OK)]
|
||||
[Permission("PermissionManagement.Read, RoleManagement.Read")]
|
||||
//[Permission("PermissionManagement.Read, RoleManagement.Read")]
|
||||
public async Task<IActionResult> GetAllPermissionsAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await service.GetAllPermissions(cancellationToken).ConfigureAwait(false);
|
||||
@@ -57,7 +57,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
[Consumes(MimeTypes.ApplicationJson)]
|
||||
[Produces(MimeTypes.ApplicationJson)]
|
||||
[ProducesResponseType(typeof(IEnumerable<PermissionAdapter>), StatusCodes.Status200OK)]
|
||||
[Permission("PermissionManagement.Read")]
|
||||
//[Permission("PermissionManagement.Read")]
|
||||
public async Task<IActionResult> GetAllPermissionsByList([FromBody] string[] permissions, CancellationToken cancellationToken)
|
||||
{
|
||||
if (permissions == null || !permissions.Any())
|
||||
@@ -83,7 +83,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
[Consumes(MimeTypes.ApplicationJson)]
|
||||
[Produces(MimeTypes.ApplicationJson)]
|
||||
[ProducesResponseType(typeof(PermissionAdapter), StatusCodes.Status200OK)]
|
||||
[Permission("PermissionManagement.Read")]
|
||||
//[Permission("PermissionManagement.Read")]
|
||||
public async Task<IActionResult> GetPermissionByIdAsync([FromRoute] string _id, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await service.GetPermissionById(_id, cancellationToken).ConfigureAwait(false);
|
||||
@@ -107,7 +107,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
/// <response code="500">Internal server error.</response>
|
||||
[HttpPost]
|
||||
[ProducesResponseType(typeof(PermissionAdapter), StatusCodes.Status201Created)]
|
||||
[Permission("PermissionManagement.Write")]
|
||||
//[Permission("PermissionManagement.Write")]
|
||||
public async Task<IActionResult> CreatePermissionAsync([FromBody] PermissionRequest newPermission, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await service.CreatePermission(newPermission, cancellationToken).ConfigureAwait(false);
|
||||
@@ -130,7 +130,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
[Consumes(MimeTypes.ApplicationJson)]
|
||||
[Produces(MimeTypes.ApplicationJson)]
|
||||
[ProducesResponseType(typeof(PermissionAdapter), StatusCodes.Status200OK)]
|
||||
[Permission("PermissionManagement.Write")]
|
||||
//[Permission("PermissionManagement.Write")]
|
||||
public async Task<IActionResult> UpdatePermissionAsync([FromRoute] string _id, [FromBody] PermissionAdapter entity, CancellationToken cancellationToken)
|
||||
{
|
||||
if (_id != entity._Id)
|
||||
@@ -157,7 +157,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
[Consumes(MimeTypes.ApplicationJson)]
|
||||
[Produces(MimeTypes.ApplicationJson)]
|
||||
[ProducesResponseType(typeof(PermissionAdapter), StatusCodes.Status200OK)]
|
||||
[Permission("PermissionManagement.Write")]
|
||||
//[Permission("PermissionManagement.Write")]
|
||||
public async Task<IActionResult> ChangePermissionStatus([FromRoute] string _id, [FromRoute] StatusEnum newStatus, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await service.ChangePermissionStatus(_id, newStatus, cancellationToken).ConfigureAwait(false);
|
||||
@@ -180,7 +180,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
[HttpDelete]
|
||||
[Route(Routes.Id)]
|
||||
[ProducesResponseType(typeof(PermissionAdapter), StatusCodes.Status200OK)]
|
||||
[Permission("PermissionManagement.Write")]
|
||||
//[Permission("PermissionManagement.Write")]
|
||||
public async Task<IActionResult> DeletePermissionAsync([FromRoute] string _id, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await service.DeletePermission(_id, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
[Produces(MimeTypes.ApplicationJson)]
|
||||
[Consumes(MimeTypes.ApplicationJson)]
|
||||
[ApiController]
|
||||
[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
|
||||
//[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
|
||||
public class RoleController(IRoleProvider service) : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
@@ -34,7 +34,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
/// <response code="500">The service internal error.</response>
|
||||
[HttpGet]
|
||||
[ProducesResponseType(typeof(IEnumerable<RoleAdapter>), StatusCodes.Status200OK)]
|
||||
[Permission("RoleManagement.Read")]
|
||||
//[Permission("RoleManagement.Read")]
|
||||
public async Task<IActionResult> GetAllRolesAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await service.GetAllRoles(cancellationToken).ConfigureAwait(false);
|
||||
@@ -53,7 +53,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
[HttpGet]
|
||||
[Route(Routes.Id)]
|
||||
[ProducesResponseType(typeof(RoleAdapter), StatusCodes.Status200OK)]
|
||||
[Permission("RoleManagement.Read")]
|
||||
//[Permission("RoleManagement.Read")]
|
||||
public async Task<IActionResult> GetRoleByIdAsync([FromRoute] string _id, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await service.GetRoleById(_id, cancellationToken).ConfigureAwait(false);
|
||||
@@ -77,7 +77,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
/// <response code="500">The service internal error.</response>
|
||||
[HttpPost]
|
||||
[ProducesResponseType(typeof(RoleAdapter), StatusCodes.Status201Created)]
|
||||
[Permission("RoleManagement.Write")]
|
||||
//[Permission("RoleManagement.Write")]
|
||||
public async Task<IActionResult> CreateRoleAsync([FromBody] RoleRequest newRole, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await service.CreateRole(newRole, cancellationToken).ConfigureAwait(false);
|
||||
@@ -98,7 +98,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
[HttpPut]
|
||||
[Route(Routes.Id)]
|
||||
[ProducesResponseType(typeof(RoleAdapter), StatusCodes.Status200OK)]
|
||||
[Permission("RoleManagement.Write")]
|
||||
//[Permission("RoleManagement.Write")]
|
||||
public async Task<IActionResult> UpdateRoleAsync([FromRoute] string _id, [FromBody] RoleAdapter entity, CancellationToken cancellationToken)
|
||||
{
|
||||
if (_id != entity._Id)
|
||||
@@ -122,7 +122,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
[HttpPatch]
|
||||
[Route(Routes.ChangeStatus)]
|
||||
[ProducesResponseType(typeof(RoleAdapter), StatusCodes.Status200OK)]
|
||||
[Permission("RoleManagement.Write")]
|
||||
//[Permission("RoleManagement.Write")]
|
||||
public async Task<IActionResult> ChangeRoleStatus([FromRoute] string _id, [FromRoute] StatusEnum newStatus, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await service.ChangeRoleStatus(_id, newStatus, cancellationToken).ConfigureAwait(false);
|
||||
@@ -144,7 +144,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
/// <response code="500">The service internal error.</response>
|
||||
[HttpPost(Routes.AddApplication)]
|
||||
[ProducesResponseType(typeof(RoleAdapter), StatusCodes.Status200OK)]
|
||||
[Permission("RoleManagement.Write")]
|
||||
//[Permission("RoleManagement.Write")]
|
||||
public async Task<IActionResult> AddApplicationToRoleAsync([FromRoute] string roleId, [FromRoute] ApplicationsEnum application, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await service.AddApplicationToRole(roleId, application, cancellationToken).ConfigureAwait(false);
|
||||
@@ -162,7 +162,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
/// <response code="500">The service internal error.</response>
|
||||
[HttpDelete(Routes.RemoveApplication)]
|
||||
[ProducesResponseType(typeof(RoleAdapter), StatusCodes.Status200OK)]
|
||||
[Permission("RoleManagement.Write")]
|
||||
//[Permission("RoleManagement.Write")]
|
||||
public async Task<IActionResult> RemoveApplicationFromRoleAsync([FromRoute] string roleId, [FromRoute] ApplicationsEnum application, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await service.RemoveApplicationFromRole(roleId, application, cancellationToken).ConfigureAwait(false);
|
||||
@@ -181,7 +181,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
[HttpDelete]
|
||||
[Route(Routes.Id)]
|
||||
[ProducesResponseType(typeof(RoleAdapter), StatusCodes.Status200OK)]
|
||||
[Permission("RoleManagement.Write")]
|
||||
//[Permission("RoleManagement.Write")]
|
||||
public async Task<IActionResult> DeleteRoleAsync([FromRoute] string _id, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await service.DeleteRole(_id, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
[Produces(MimeTypes.ApplicationJson)]
|
||||
[Consumes(MimeTypes.ApplicationJson)]
|
||||
[ApiController]
|
||||
[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
|
||||
//[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
|
||||
public class TenantController(ITenantProvider service) : ControllerBase
|
||||
{
|
||||
/// <summary>
|
||||
@@ -36,7 +36,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
[Consumes(MimeTypes.ApplicationJson)]
|
||||
[Produces(MimeTypes.ApplicationJson)]
|
||||
[ProducesResponseType(typeof(IEnumerable<TenantAdapter>), StatusCodes.Status200OK)]
|
||||
[Permission("TenantManagement.Read, RoleManagement.Read")]
|
||||
//[Permission("TenantManagement.Read, RoleManagement.Read")]
|
||||
public async Task<IActionResult> GetAllTenantsAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await service.GetAllTenants(cancellationToken).ConfigureAwait(false);
|
||||
@@ -57,7 +57,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
[Consumes(MimeTypes.ApplicationJson)]
|
||||
[Produces(MimeTypes.ApplicationJson)]
|
||||
[ProducesResponseType(typeof(TenantAdapter), StatusCodes.Status200OK)]
|
||||
[Permission("TenantManagement.Read")]
|
||||
//[Permission("TenantManagement.Read")]
|
||||
public async Task<IActionResult> GetTenantByIdAsync([FromRoute] string _id, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await service.GetTenantById(_id, cancellationToken).ConfigureAwait(false);
|
||||
@@ -81,7 +81,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
/// <response code="500">The service internal error.</response>
|
||||
[HttpPost]
|
||||
[ProducesResponseType(typeof(TenantAdapter), StatusCodes.Status201Created)]
|
||||
[Permission("TenantManagement.Write")]
|
||||
//[Permission("TenantManagement.Write")]
|
||||
public async Task<IActionResult> CreateTenantAsync([FromBody] TenantRequest newTenant, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await service.CreateTenant(newTenant, cancellationToken).ConfigureAwait(false);
|
||||
@@ -104,7 +104,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
[Consumes(MimeTypes.ApplicationJson)]
|
||||
[Produces(MimeTypes.ApplicationJson)]
|
||||
[ProducesResponseType(typeof(TenantAdapter), StatusCodes.Status200OK)]
|
||||
[Permission("TenantManagement.Write")]
|
||||
//[Permission("TenantManagement.Write")]
|
||||
public async Task<IActionResult> UpdateTenantAsync([FromRoute] string _id, [FromBody] TenantAdapter entity, CancellationToken cancellationToken)
|
||||
{
|
||||
if (_id != entity._Id)
|
||||
@@ -132,7 +132,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
[Consumes(MimeTypes.ApplicationJson)]
|
||||
[Produces(MimeTypes.ApplicationJson)]
|
||||
[ProducesResponseType(typeof(TenantAdapter), StatusCodes.Status200OK)]
|
||||
[Permission("TenantManagement.Write")]
|
||||
//[Permission("TenantManagement.Write")]
|
||||
public async Task<IActionResult> ChangeTenantStatus([FromRoute] string _id, [FromRoute] StatusEnum newStatus, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await service.ChangeTenantStatus(_id, newStatus, cancellationToken).ConfigureAwait(false);
|
||||
@@ -155,7 +155,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
[HttpDelete]
|
||||
[Route(Routes.Id)]
|
||||
[ProducesResponseType(typeof(TenantAdapter), StatusCodes.Status200OK)]
|
||||
[Permission("TenantManagement.Write")]
|
||||
//[Permission("TenantManagement.Write")]
|
||||
public async Task<IActionResult> DeleteTenantAsync([FromRoute] string _id, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await service.DeleteTenant(_id, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
@@ -31,8 +31,8 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
/// <returns>The <see cref="IEnumerable{UserAdapter}"/> found entity.</returns>
|
||||
[HttpGet]
|
||||
[ProducesResponseType(typeof(IEnumerable<UserAdapter>), StatusCodes.Status200OK)]
|
||||
[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
|
||||
[Permission("UserManagement.Read")]
|
||||
//[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
|
||||
//[Permission("UserManagement.Read")]
|
||||
public async Task<IActionResult> GetAllUsers(CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await service.GetAllUsers(cancellationToken).ConfigureAwait(false);
|
||||
@@ -48,8 +48,8 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
[HttpGet]
|
||||
[Route(Routes.Id)]
|
||||
[ProducesResponseType(typeof(UserAdapter), StatusCodes.Status200OK)]
|
||||
[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
|
||||
[Permission("UserManagement.Read")]
|
||||
//[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
|
||||
//[Permission("UserManagement.Read")]
|
||||
public async Task<IActionResult> GetUserById([FromRoute] string _id, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await service.GetUserById(_id, cancellationToken).ConfigureAwait(false);
|
||||
@@ -65,7 +65,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
[HttpGet]
|
||||
[Route(Routes.Email)]
|
||||
[ProducesResponseType(typeof(UserAdapter), StatusCodes.Status200OK)]
|
||||
[Authorize(AuthenticationSchemes = $"{Schemes.DefaultScheme}, {Schemes.GoogleScheme}")]
|
||||
//[Authorize(AuthenticationSchemes = $"{Schemes.DefaultScheme}, {Schemes.GoogleScheme}")]
|
||||
public async Task<IActionResult> GetUserByEmail([FromRoute] string email, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await service.GetUserByEmail(email, cancellationToken).ConfigureAwait(false);
|
||||
@@ -96,8 +96,8 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
/// <returns>The <see cref="UserAdapter"/> created entity.</returns>
|
||||
[HttpPost(Routes.Register)]
|
||||
[ProducesResponseType(typeof(UserAdapter), StatusCodes.Status201Created)]
|
||||
[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
|
||||
[Permission("UserManagement.Write")]
|
||||
//[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
|
||||
//[Permission("UserManagement.Write")]
|
||||
public async Task<IActionResult> CreateUserAsync([FromBody] UserRequest newUser, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await service.CreateUser(newUser, cancellationToken).ConfigureAwait(false);
|
||||
@@ -114,8 +114,8 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
[HttpPut]
|
||||
[Route(Routes.Id)]
|
||||
[ProducesResponseType(typeof(UserAdapter), StatusCodes.Status200OK)]
|
||||
[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
|
||||
[Permission("UserManagement.Write")]
|
||||
//[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
|
||||
//[Permission("UserManagement.Write")]
|
||||
public async Task<IActionResult> UpdateUserAsync([FromRoute] string _id, [FromBody] UserAdapter entity, CancellationToken cancellationToken)
|
||||
{
|
||||
if (_id != entity._Id)
|
||||
@@ -133,7 +133,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
/// <returns>The <see cref="UserAdapter"/> found entity.</returns>
|
||||
[HttpPatch(Routes.LogIn)]
|
||||
[ProducesResponseType(typeof(UserAdapter), StatusCodes.Status200OK)]
|
||||
[Authorize(AuthenticationSchemes = $"{Schemes.DefaultScheme}, {Schemes.GoogleScheme}")]
|
||||
//[Authorize(AuthenticationSchemes = $"{Schemes.DefaultScheme}, {Schemes.GoogleScheme}")]
|
||||
public async Task<IActionResult> LoginUserAsync([FromRoute] string email, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await service.LogInUser(email, cancellationToken).ConfigureAwait(false);
|
||||
@@ -148,7 +148,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
/// <returns>The <see cref="UserAdapter"/> updated entity.</returns>
|
||||
[HttpPatch(Routes.LogOut)]
|
||||
[ProducesResponseType(typeof(UserAdapter), StatusCodes.Status200OK)]
|
||||
[Authorize(AuthenticationSchemes = $"{Schemes.DefaultScheme}, {Schemes.GoogleScheme}")]
|
||||
//[Authorize(AuthenticationSchemes = $"{Schemes.DefaultScheme}, {Schemes.GoogleScheme}")]
|
||||
public async Task<IActionResult> LogOutUserSessionAsync([FromRoute] string email, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await service.LogOutUserSession(email, cancellationToken).ConfigureAwait(false);
|
||||
@@ -165,8 +165,8 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
[HttpPatch]
|
||||
[Route(Routes.ChangeStatus)]
|
||||
[ProducesResponseType(typeof(UserAdapter), StatusCodes.Status200OK)]
|
||||
[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
|
||||
[Permission("UserManagement.Write")]
|
||||
//[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
|
||||
//[Permission("UserManagement.Write")]
|
||||
public async Task<IActionResult> ChangeUserStatus([FromRoute] string _id, [FromRoute] StatusEnum newStatus, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await service.ChangeUserStatus(_id, newStatus, cancellationToken).ConfigureAwait(false);
|
||||
@@ -186,7 +186,7 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
[HttpGet]
|
||||
[Route("{email}/GetTokenAdapter")]
|
||||
[ProducesResponseType(typeof(TokenAdapter), StatusCodes.Status200OK)]
|
||||
[Authorize(AuthenticationSchemes = $"{Schemes.DefaultScheme}, {Schemes.GoogleScheme}")]
|
||||
//[Authorize(AuthenticationSchemes = $"{Schemes.DefaultScheme}, {Schemes.GoogleScheme}")]
|
||||
public async Task<IActionResult> GetTokenAdapter([FromRoute] string email, CancellationToken cancellationToken)
|
||||
{
|
||||
var tokenAdapter = await service.GetToken(email, cancellationToken).ConfigureAwait(false);
|
||||
@@ -204,8 +204,8 @@ namespace LSA.Core.Thalos.API.Controllers
|
||||
[HttpDelete]
|
||||
[Route(Routes.Id)]
|
||||
[ProducesResponseType(typeof(UserAdapter), StatusCodes.Status200OK)]
|
||||
[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
|
||||
[Permission("UserManagement.Write")]
|
||||
//[Authorize(AuthenticationSchemes = Schemes.DefaultScheme)]
|
||||
//[Permission("UserManagement.Write")]
|
||||
public async Task<IActionResult> DeleteUserAsync([FromRoute] string _id, CancellationToken cancellationToken)
|
||||
{
|
||||
var result = await service.DeleteUser(_id, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
"dotnetRunMessages": true,
|
||||
"launchBrowser": true,
|
||||
"launchUrl": "swagger",
|
||||
"applicationUrl": "https://localhost:7031;http://localhost:5211",
|
||||
"applicationUrl": "https://localhost:44359;http://localhost:5211",
|
||||
"environmentVariables": {
|
||||
"ASPNETCORE_ENVIRONMENT": "Local"
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
},
|
||||
"AllowedHosts": "*",
|
||||
"ConnectionStrings": {
|
||||
"MongoDB": "mongodb://admin_agile:Admin%40agileWebs@portainer.white-enciso.pro:27017/?authMechanism=SCRAM-SHA-256",
|
||||
"Redis": "100.123.31.103:6379"
|
||||
"MongoDB": "mongodb://admin_agile:AdminAgileWebs@portainer.dream-views.com:27017/?authMechanism=SCRAM-SHA-256",
|
||||
"Redis": "portainer.dream-views.com:6379"
|
||||
},
|
||||
"MongoDb": {
|
||||
"DatabaseName": "Thalos",
|
||||
@@ -25,11 +25,11 @@
|
||||
},
|
||||
"Vault": {
|
||||
"Address": "http://100.123.31.103:8200",
|
||||
"Token": "hvs.e37LQvLuPhTd5ALS5QQ03Cwm",
|
||||
"Token": "hvs.kLjCgmm6ABeuwJNFYma9kDdy",
|
||||
"SecretMount": "secret"
|
||||
},
|
||||
"IdentityProviders": {
|
||||
"Google": true,
|
||||
"Azure": true
|
||||
"Azure": false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Core.Blueprint.KeyVault" Version="1.0.3" />
|
||||
<PackageReference Include="Core.Thalos.BuildingBlocks" Version="1.1.2" />
|
||||
<PackageReference Include="Core.Thalos.BuildingBlocks" Version="1.1.8" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -82,7 +82,7 @@ namespace Core.Thalos.Provider.Providers.Onboarding
|
||||
var cacheKey = CacheKeyHelper.GenerateCacheKey(this, "GetAllUsers");
|
||||
var cachedData = await cacheProvider.GetAsync<IEnumerable<UserAdapter>>(cacheKey) ?? [];
|
||||
|
||||
//if (cachedData.Any()) return cachedData;
|
||||
if (cachedData.Any()) return cachedData;
|
||||
|
||||
var users = await repository.AsQueryable();
|
||||
|
||||
@@ -243,6 +243,16 @@ namespace Core.Thalos.Provider.Providers.Onboarding
|
||||
new BsonDocument("$unwind", "$role"),
|
||||
new BsonDocument("$match", new BsonDocument("role.status", Core.Blueprint.Mongo.StatusEnum.Active.ToString())),
|
||||
|
||||
// Tenant lookup
|
||||
new BsonDocument("$lookup", new BsonDocument
|
||||
{
|
||||
{ "from", "Tenants" },
|
||||
{ "localField", "tenantId" },
|
||||
{ "foreignField", "_id" },
|
||||
{ "as", "tenant" }
|
||||
}),
|
||||
new BsonDocument("$unwind", "$tenant"),
|
||||
|
||||
new BsonDocument("$addFields", new BsonDocument
|
||||
{
|
||||
{ "role.permissions", new BsonDocument("$map", new BsonDocument
|
||||
@@ -305,6 +315,25 @@ namespace Core.Thalos.Provider.Providers.Onboarding
|
||||
{ "role.updatedAt", 1 },
|
||||
{ "role.createdBy", 1 },
|
||||
{ "role.updatedBy", 1 },
|
||||
{ "tenant._id", 1 },
|
||||
{ "tenant.name", 1 },
|
||||
{ "tenant.taxIdentifier", 1 },
|
||||
{ "tenant.addressLine1", 1 },
|
||||
{ "tenant.addressLine2", 1 },
|
||||
{ "tenant.city", 1 },
|
||||
{ "tenant.state", 1 },
|
||||
{ "tenant.country", 1 },
|
||||
{ "tenant.postalCode", 1 },
|
||||
{ "tenant.contactEmail", 1 },
|
||||
{ "tenant.contactPhone", 1 },
|
||||
{ "tenant.website", 1 },
|
||||
{ "tenant.connectionString", 1 },
|
||||
{ "tenant.isolated", 1 },
|
||||
{ "tenant.status", 1 },
|
||||
{ "tenant.createdAt", 1 },
|
||||
{ "tenant.updatedAt", 1 },
|
||||
{ "tenant.createdBy", 1 },
|
||||
{ "tenant.updatedBy", 1 },
|
||||
{ "permissions", 1 },
|
||||
{ "modules", 1 }
|
||||
})
|
||||
@@ -318,8 +347,7 @@ namespace Core.Thalos.Provider.Providers.Onboarding
|
||||
{
|
||||
User = new UserAdapter
|
||||
{
|
||||
Id = result["_id"]?.ToString() ?? "",
|
||||
Guid = result.Contains("guid") && !result["guid"].IsBsonNull ? result["guid"].AsString : string.Empty,
|
||||
_Id = result["_id"]?.ToString() ?? "",
|
||||
Email = result.Contains("email") && !result["email"].IsBsonNull ? result["email"].AsString : string.Empty,
|
||||
Name = result.Contains("name") && !result["name"].IsBsonNull ? result["name"].AsString : string.Empty,
|
||||
MiddleName = result.Contains("middleName") && !result["middleName"].IsBsonNull ? result["middleName"].AsString : string.Empty,
|
||||
@@ -397,13 +425,82 @@ namespace Core.Thalos.Provider.Providers.Onboarding
|
||||
? result["role"]["updatedBy"].AsString
|
||||
: string.Empty
|
||||
},
|
||||
Tenant = result.Contains("tenant") && result["tenant"].IsBsonDocument
|
||||
? new TenantAdapter
|
||||
{
|
||||
Id = result.Contains("tenant") && result["tenant"].IsBsonDocument && result["tenant"].AsBsonDocument.Contains("_id")
|
||||
? result["tenant"]["_id"]?.ToString() ?? ""
|
||||
: string.Empty,
|
||||
Name = result["tenant"].AsBsonDocument.Contains("name") && !result["tenant"]["name"].IsBsonNull
|
||||
? result["tenant"]["name"].AsString
|
||||
: string.Empty,
|
||||
TaxIdentifier = result["tenant"].AsBsonDocument.Contains("taxIdentifier") && !result["tenant"]["taxIdentifier"].IsBsonNull
|
||||
? result["tenant"]["taxIdentifier"].AsString
|
||||
: string.Empty,
|
||||
AddressLine1 = result["tenant"].AsBsonDocument.Contains("addressLine1") && !result["tenant"]["addressLine1"].IsBsonNull
|
||||
? result["tenant"]["addressLine1"].AsString
|
||||
: string.Empty,
|
||||
AddressLine2 = result["tenant"].AsBsonDocument.Contains("addressLine2") && !result["tenant"]["addressLine2"].IsBsonNull
|
||||
? result["tenant"]["addressLine2"].AsString
|
||||
: null,
|
||||
City = result["tenant"].AsBsonDocument.Contains("city") && !result["tenant"]["city"].IsBsonNull
|
||||
? result["tenant"]["city"].AsString
|
||||
: string.Empty,
|
||||
State = result["tenant"].AsBsonDocument.Contains("state") && !result["tenant"]["state"].IsBsonNull
|
||||
? result["tenant"]["state"].AsString
|
||||
: string.Empty,
|
||||
Country = result["tenant"].AsBsonDocument.Contains("country") && !result["tenant"]["country"].IsBsonNull
|
||||
? result["tenant"]["country"].AsString
|
||||
: string.Empty,
|
||||
PostalCode = result["tenant"].AsBsonDocument.Contains("postalCode") && !result["tenant"]["postalCode"].IsBsonNull
|
||||
? result["tenant"]["postalCode"].AsString
|
||||
: string.Empty,
|
||||
ContactEmail = result["tenant"].AsBsonDocument.Contains("contactEmail") && !result["tenant"]["contactEmail"].IsBsonNull
|
||||
? result["tenant"]["contactEmail"].AsString
|
||||
: string.Empty,
|
||||
ContactPhone = result["tenant"].AsBsonDocument.Contains("contactPhone") && !result["tenant"]["contactPhone"].IsBsonNull
|
||||
? result["tenant"]["contactPhone"].AsString
|
||||
: string.Empty,
|
||||
Website = result["tenant"].AsBsonDocument.Contains("website") && !result["tenant"]["website"].IsBsonNull
|
||||
? result["tenant"]["website"].AsString
|
||||
: null,
|
||||
ConnectionString = result["tenant"].AsBsonDocument.Contains("connectionString") && !result["tenant"]["connectionString"].IsBsonNull
|
||||
? result["tenant"]["connectionString"].AsString
|
||||
: null,
|
||||
Isolated = result["tenant"].AsBsonDocument.Contains("isolated") && !result["tenant"]["isolated"].IsBsonNull
|
||||
? result["tenant"]["isolated"].ToBoolean()
|
||||
: false,
|
||||
CreatedAt = result["tenant"].AsBsonDocument.Contains("createdAt") && !result["tenant"]["createdAt"].IsBsonNull
|
||||
? result["tenant"]["createdAt"].ToUniversalTime()
|
||||
: DateTime.MinValue,
|
||||
UpdatedAt = result["tenant"].AsBsonDocument.Contains("updatedAt") && !result["tenant"]["updatedAt"].IsBsonNull
|
||||
? result["tenant"]["updatedAt"].ToUniversalTime()
|
||||
: DateTime.MinValue,
|
||||
CreatedBy = result["tenant"].AsBsonDocument.Contains("createdBy") && !result["tenant"]["createdBy"].IsBsonNull
|
||||
? result["tenant"]["createdBy"].AsString
|
||||
: string.Empty,
|
||||
UpdatedBy = result["tenant"].AsBsonDocument.Contains("updatedBy") && !result["tenant"]["updatedBy"].IsBsonNull
|
||||
? result["tenant"]["updatedBy"].AsString
|
||||
: string.Empty,
|
||||
Status = result["tenant"].AsBsonDocument.Contains("status") && !result["tenant"]["status"].IsBsonNull
|
||||
? (Core.Blueprint.Mongo.StatusEnum)Enum.Parse(typeof(Core.Blueprint.Mongo.StatusEnum), result["tenant"]["status"].AsString)
|
||||
: Core.Blueprint.Mongo.StatusEnum.Active
|
||||
}
|
||||
: null,
|
||||
Permissions = result.Contains("permissions") && result["permissions"].IsBsonArray
|
||||
? result["permissions"].AsBsonArray
|
||||
.Where(p => p != null && p.IsBsonDocument)
|
||||
.Select(p => BsonSerializer.Deserialize<PermissionAdapter>(p.AsBsonDocument))
|
||||
.Where(p => p.Status == Core.Blueprint.Mongo.StatusEnum.Active)
|
||||
.ToList()
|
||||
: new List<PermissionAdapter>()
|
||||
: new List<PermissionAdapter>(),
|
||||
Modules = result.Contains("modules") && result["modules"].IsBsonArray
|
||||
? result["modules"].AsBsonArray
|
||||
.Where(p => p != null && p.IsBsonDocument)
|
||||
.Select(p => BsonSerializer.Deserialize<ModuleAdapter>(p.AsBsonDocument))
|
||||
.Where(p => p.Status == Core.Blueprint.Mongo.StatusEnum.Active)
|
||||
.ToList()
|
||||
: new List<ModuleAdapter>()
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user