private bool TryAuthorize <T>(ChunkedRequestHelper <T> request) { if (request.Type(InstanceCrypto) == ChunkedRequestType.Initiate) { TenantManager.SetCurrentTenant(request.TenantId); SecurityContext.AuthenticateMe(AuthManager.GetAccountByID(TenantManager.GetCurrentTenant().TenantId, request.AuthKey(InstanceCrypto))); var cultureInfo = request.CultureInfo(SetupInfo); if (cultureInfo != null) { Thread.CurrentThread.CurrentUICulture = cultureInfo; } return(true); } if (!string.IsNullOrEmpty(request.UploadId)) { var uploadSession = ChunkedUploadSessionHolder.GetSession(request.UploadId); if (uploadSession != null) { TenantManager.SetCurrentTenant(uploadSession.TenantId); SecurityContext.AuthenticateMe(AuthManager.GetAccountByID(TenantManager.GetCurrentTenant().TenantId, uploadSession.UserId)); var culture = SetupInfo.EnabledCulturesPersonal.Find(c => string.Equals(c.Name, uploadSession.CultureName, StringComparison.InvariantCultureIgnoreCase)); if (culture != null) { Thread.CurrentThread.CurrentUICulture = culture; } return(true); } } return(false); }
private bool TryAuthorize <T>(ChunkedRequestHelper <T> request) { if (request.Type(InstanceCrypto) == ChunkedRequestType.Initiate) { TenantManager.SetCurrentTenant(request.TenantId); SecurityContext.AuthenticateMeWithoutCookie(AuthManager.GetAccountByID(TenantManager.GetCurrentTenant().TenantId, request.AuthKey(InstanceCrypto))); var cultureInfo = request.CultureInfo(SetupInfo); if (cultureInfo != null) { Thread.CurrentThread.CurrentUICulture = cultureInfo; } return(true); } if (!string.IsNullOrEmpty(request.UploadId)) { var uploadSession = ChunkedUploadSessionHolder.GetSession <T>(request.UploadId); if (uploadSession != null) { TenantManager.SetCurrentTenant(uploadSession.TenantId); SecurityContext.AuthenticateMeWithoutCookie(AuthManager.GetAccountByID(TenantManager.GetCurrentTenant().TenantId, uploadSession.UserId)); var culture = SetupInfo.GetPersonalCulture(uploadSession.CultureName).Value; if (culture != null) { Thread.CurrentThread.CurrentUICulture = culture; } return(true); } } return(false); }