Revise TBB and authentication logic
This commit is contained in:
		| @@ -7,15 +7,13 @@ | ||||
| using Core.Blueprint.Mongo; | ||||
| using Core.Blueprint.Redis; | ||||
| using Core.Blueprint.Redis.Helpers; | ||||
| using Core.Thalos.Adapters; | ||||
| using Core.Thalos.Adapters.Common.Enums; | ||||
| using Core.Thalos.BuildingBlocks; | ||||
| using Core.Thalos.Provider.Contracts; | ||||
| using Mapster; | ||||
| using Microsoft.Extensions.Options; | ||||
| using MongoDB.Bson; | ||||
| using MongoDB.Bson.Serialization; | ||||
| using MongoDB.Driver; | ||||
| using System.Reflection; | ||||
| using System.Text.RegularExpressions; | ||||
|  | ||||
| namespace Core.Thalos.Provider.Providers.Onboarding | ||||
| @@ -27,18 +25,18 @@ namespace Core.Thalos.Provider.Providers.Onboarding | ||||
|     { | ||||
|         private readonly CollectionRepository<UserAdapter> repository; | ||||
|         private readonly CacheSettings cacheSettings; | ||||
| 		private readonly IRedisCacheProvider cacheProvider; | ||||
|         private readonly IRedisCacheProvider cacheProvider; | ||||
|  | ||||
| 		public UserProvider(CollectionRepository<UserAdapter> repository, | ||||
|         public UserProvider(CollectionRepository<UserAdapter> repository, | ||||
|             IRedisCacheProvider cacheProvider, | ||||
| 			IOptions<CacheSettings> cacheSettings | ||||
|             IOptions<CacheSettings> cacheSettings | ||||
|             ) | ||||
|         { | ||||
|             this.repository = repository; | ||||
|             this.repository.CollectionInitialization(); | ||||
| 			this.cacheSettings = cacheSettings.Value; | ||||
| 			this.cacheProvider = cacheProvider; | ||||
| 		} | ||||
|             this.cacheSettings = cacheSettings.Value; | ||||
|             this.cacheProvider = cacheProvider; | ||||
|         } | ||||
|  | ||||
|         /// <summary> | ||||
|         /// Creates a new User. | ||||
| @@ -108,7 +106,7 @@ namespace Core.Thalos.Provider.Providers.Onboarding | ||||
|             //if (cachedData is not null) { return cachedData; } | ||||
|  | ||||
|             var user = await repository.FindOneAsync( | ||||
|                 u => u.Email == email &&  | ||||
|                 u => u.Email == email && | ||||
|                 u.Status == Core.Blueprint.Mongo.StatusEnum.Active); | ||||
|  | ||||
|             await cacheProvider.SetAsync(cacheKey, user); | ||||
| @@ -419,7 +417,7 @@ namespace Core.Thalos.Provider.Providers.Onboarding | ||||
|                                 .Select(c => c.AsString) | ||||
|                                 .ToArray() | ||||
|                             : Array.Empty<string>(), | ||||
|                                         Projects = result.Contains("projects") && result["projects"].IsBsonArray | ||||
|                         Projects = result.Contains("projects") && result["projects"].IsBsonArray | ||||
|                             ? result["projects"].AsBsonArray | ||||
|                                 .Where(p => p != null && !p.IsBsonNull) | ||||
|                                 .Select(p => p.AsString) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user