reeplace cerberos by talos
This commit is contained in:
		| @@ -0,0 +1,39 @@ | ||||
| // *********************************************************************** | ||||
| // <copyright file="PermissionMapper.cs"> | ||||
| //    AgileWebs | ||||
| // </copyright> | ||||
| // *********************************************************************** | ||||
| using Core.Thalos.Adapters; | ||||
| using Core.Thalos.Domain.Contexts.Onboarding.Request; | ||||
| using Microsoft.AspNetCore.Http; | ||||
| using MongoDB.Bson; | ||||
| using System.Security.Claims; | ||||
| namespace Core.Thalos.Domain.Contexts.Onboarding.Mappers | ||||
| { | ||||
|     /// <summary> | ||||
|     /// Handles mappings between | ||||
|     /// <see cref="PermissionRequest"/>, | ||||
|     /// and <see cref="PermissionAdapter"/> | ||||
|     /// </summary> | ||||
|     public static class PermissionMapper | ||||
|     { | ||||
|         /// <summary> | ||||
|         /// Maps the permissionRequest to PermissionAdapter. | ||||
|         /// </summary> | ||||
|         /// <param name="newPermission">The Permission to be mapped.</param> | ||||
|         /// <returns>A <see cref="PermissionAdapter"/> representing | ||||
|         /// the asynchronous execution of the service.</returns> | ||||
|         public static PermissionAdapter ToAdapter(this PermissionRequest newPermission, IHttpContextAccessor httpContextAccessor) | ||||
|         { | ||||
|             return new PermissionAdapter | ||||
|             { | ||||
|                 Id = ObjectId.GenerateNewId().ToString(), | ||||
|                 Name = newPermission.Name, | ||||
|                 Description = newPermission.Description, | ||||
|                 CreatedAt = DateTime.UtcNow, | ||||
|                 CreatedBy = httpContextAccessor.HttpContext?.User?.FindFirst(ClaimTypes.Email)?.Value ?? string.Empty, | ||||
|                 AccessLevel = newPermission.AccessLevel | ||||
|             }; | ||||
|         } | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Sergio Matias Urquin
					Sergio Matias Urquin