AB4227 - Moved a mix of files
This commit is contained in:
@@ -128,42 +128,29 @@
|
||||
-->
|
||||
<Compile Include="Compose\AuditEventsComponent.cs" />
|
||||
<Compile Include="Compose\AuditEventsComposer.cs" />
|
||||
<Compile Include="Composing\RegisterFactory.cs" />
|
||||
<Compile Include="Composing\CompositionExtensions\Configuration.cs" />
|
||||
<Compile Include="Composing\CompositionExtensions\CoreMappingProfiles.cs" />
|
||||
<Compile Include="Composing\CompositionExtensions\FileSystems.cs" />
|
||||
<Compile Include="Composing\CompositionExtensions\Repositories.cs" />
|
||||
<Compile Include="Composing\CompositionExtensions\Services.cs" />
|
||||
<Compile Include="Deploy\IGridCellValueConnector.cs" />
|
||||
<Compile Include="Composing\Current.cs" />
|
||||
<Compile Include="Composing\LightInject\LightInjectContainer.cs" />
|
||||
<Compile Include="Composing\LightInject\MixedLightInjectScopeManagerProvider.cs" />
|
||||
<Compile Include="Models\Identity\BackOfficeIdentityUser.cs" />
|
||||
<Compile Include="Models\Identity\IdentityMapDefinition.cs" />
|
||||
<Compile Include="Models\Identity\IdentityUser.cs" />
|
||||
<Compile Include="Models\Identity\UserLoginInfoWrapper.cs" />
|
||||
<Compile Include="Models\UserExtensions.cs" />
|
||||
<Compile Include="Persistence\SqlCeBulkSqlInsertProvider.cs" />
|
||||
<Compile Include="Persistence\SqlSyntax\SqlCeSyntaxProvider.cs" />
|
||||
<Compile Include="PublishedContentExtensions.cs" />
|
||||
<Compile Include="Runtime\CoreInitialComposer.cs" />
|
||||
<Compile Include="Runtime\CoreRuntime.cs" />
|
||||
<Compile Include="Security\AuthenticationExtensions.cs" />
|
||||
<Compile Include="Security\PasswordSecurity.cs" />
|
||||
<Compile Include="Security\UmbracoBackOfficeIdentity.cs" />
|
||||
<Compile Include="StringExtensions.cs" />
|
||||
<Compile Include="TypeLoaderExtensions.cs" />
|
||||
<Compile Include="RuntimeOptions.cs" />
|
||||
<Compile Include="Runtime\CoreRuntime.cs" />
|
||||
<Compile Include="Runtime\CoreInitialComponent.cs" />
|
||||
<Compile Include="Composing\LightInject\LightInjectException.cs" />
|
||||
<Compile Include="FileResources\Files.Designer.cs" />
|
||||
<Compile Include="MainDom.cs" />
|
||||
<Compile Include="ContentExtensions.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="RuntimeState.cs" />
|
||||
<Compile Include="Runtime\CoreInitialComposer.cs" />
|
||||
<Compile Include="Security\BackOfficeUserStore.cs" />
|
||||
<Compile Include="Security\BackOfficeUserValidator.cs" />
|
||||
<Compile Include="Security\ContentPermissionsHelper.cs" />
|
||||
<Compile Include="Security\EmailService.cs" />
|
||||
<Compile Include="Security\IUserAwarePasswordHasher.cs" />
|
||||
<Compile Include="Security\IUserSessionStore.cs" />
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.IO.MediaPathSchemes;
|
||||
using Umbraco.Core.Logging;
|
||||
|
||||
@@ -90,7 +91,7 @@ namespace Umbraco.Core.Composing.CompositionExtensions
|
||||
// register the IFileSystem supporting the IMediaFileSystem
|
||||
// THIS IS THE ONLY THING THAT NEEDS TO CHANGE, IN ORDER TO REPLACE THE UNDERLYING FILESYSTEM
|
||||
// and, SupportingFileSystem.For<IMediaFileSystem>() returns the underlying filesystem
|
||||
composition.SetMediaFileSystem(factory => new PhysicalFileSystem(factory.GetInstance<IIOHelper>(), factory.GetInstance<ILogger>(), Current.Configs.Global().UmbracoMediaPath));
|
||||
composition.SetMediaFileSystem(factory => new PhysicalFileSystem(factory.GetInstance<IIOHelper>(), factory.GetInstance<ILogger>(), factory.GetInstance<IGlobalSettings>().UmbracoMediaPath));
|
||||
|
||||
return composition;
|
||||
}
|
||||
@@ -7,6 +7,7 @@ using System.Security.Cryptography;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Models.Entities;
|
||||
using Umbraco.Core.Models.Membership;
|
||||
using Umbraco.Core.Services;
|
||||
@@ -16,17 +17,16 @@ namespace Umbraco.Core.Models
|
||||
{
|
||||
public static class UserExtensions
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Tries to lookup the user's Gravatar to see if the endpoint can be reached, if so it returns the valid URL
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <param name="cache"></param>
|
||||
/// <param name="mediaFileSystem"></param>
|
||||
/// <returns>
|
||||
/// A list of 5 different sized avatar URLs
|
||||
/// </returns>
|
||||
internal static string[] GetUserAvatarUrls(this IUser user, IAppCache cache)
|
||||
public static string[] GetUserAvatarUrls(this IUser user, IAppCache cache, IMediaFileSystem mediaFileSystem)
|
||||
{
|
||||
// If FIPS is required, never check the Gravatar service as it only supports MD5 hashing.
|
||||
// Unfortunately, if the FIPS setting is enabled on Windows, using MD5 will throw an exception
|
||||
@@ -77,7 +77,7 @@ namespace Umbraco.Core.Models
|
||||
}
|
||||
|
||||
//use the custom avatar
|
||||
var avatarUrl = Current.MediaFileSystem.GetUrl(user.Avatar);
|
||||
var avatarUrl = mediaFileSystem.GetUrl(user.Avatar);
|
||||
return new[]
|
||||
{
|
||||
avatarUrl + "?width=30&height=30&mode=crop",
|
||||
@@ -89,47 +89,47 @@ namespace Umbraco.Core.Models
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
internal static bool HasContentRootAccess(this IUser user, IEntityService entityService)
|
||||
|
||||
public static bool HasContentRootAccess(this IUser user, IEntityService entityService)
|
||||
{
|
||||
return ContentPermissionsHelper.HasPathAccess(Constants.System.RootString, user.CalculateContentStartNodeIds(entityService), Constants.System.RecycleBinContent);
|
||||
}
|
||||
|
||||
internal static bool HasContentBinAccess(this IUser user, IEntityService entityService)
|
||||
public static bool HasContentBinAccess(this IUser user, IEntityService entityService)
|
||||
{
|
||||
return ContentPermissionsHelper.HasPathAccess(Constants.System.RecycleBinContentString, user.CalculateContentStartNodeIds(entityService), Constants.System.RecycleBinContent);
|
||||
}
|
||||
|
||||
internal static bool HasMediaRootAccess(this IUser user, IEntityService entityService)
|
||||
public static bool HasMediaRootAccess(this IUser user, IEntityService entityService)
|
||||
{
|
||||
return ContentPermissionsHelper.HasPathAccess(Constants.System.RootString, user.CalculateMediaStartNodeIds(entityService), Constants.System.RecycleBinMedia);
|
||||
}
|
||||
|
||||
internal static bool HasMediaBinAccess(this IUser user, IEntityService entityService)
|
||||
public static bool HasMediaBinAccess(this IUser user, IEntityService entityService)
|
||||
{
|
||||
return ContentPermissionsHelper.HasPathAccess(Constants.System.RecycleBinMediaString, user.CalculateMediaStartNodeIds(entityService), Constants.System.RecycleBinMedia);
|
||||
}
|
||||
|
||||
internal static bool HasPathAccess(this IUser user, IContent content, IEntityService entityService)
|
||||
public static bool HasPathAccess(this IUser user, IContent content, IEntityService entityService)
|
||||
{
|
||||
if (content == null) throw new ArgumentNullException(nameof(content));
|
||||
return ContentPermissionsHelper.HasPathAccess(content.Path, user.CalculateContentStartNodeIds(entityService), Constants.System.RecycleBinContent);
|
||||
}
|
||||
|
||||
internal static bool HasPathAccess(this IUser user, IMedia media, IEntityService entityService)
|
||||
public static bool HasPathAccess(this IUser user, IMedia media, IEntityService entityService)
|
||||
{
|
||||
if (media == null) throw new ArgumentNullException(nameof(media));
|
||||
return ContentPermissionsHelper.HasPathAccess(media.Path, user.CalculateMediaStartNodeIds(entityService), Constants.System.RecycleBinMedia);
|
||||
}
|
||||
|
||||
internal static bool HasContentPathAccess(this IUser user, IUmbracoEntity entity, IEntityService entityService)
|
||||
public static bool HasContentPathAccess(this IUser user, IUmbracoEntity entity, IEntityService entityService)
|
||||
{
|
||||
if (entity == null) throw new ArgumentNullException(nameof(entity));
|
||||
return ContentPermissionsHelper.HasPathAccess(entity.Path, user.CalculateContentStartNodeIds(entityService), Constants.System.RecycleBinContent);
|
||||
}
|
||||
|
||||
internal static bool HasMediaPathAccess(this IUser user, IUmbracoEntity entity, IEntityService entityService)
|
||||
public static bool HasMediaPathAccess(this IUser user, IUmbracoEntity entity, IEntityService entityService)
|
||||
{
|
||||
if (entity == null) throw new ArgumentNullException(nameof(entity));
|
||||
return ContentPermissionsHelper.HasPathAccess(entity.Path, user.CalculateMediaStartNodeIds(entityService), Constants.System.RecycleBinMedia);
|
||||
@@ -17,7 +17,7 @@ namespace Umbraco.Core
|
||||
/// <summary>
|
||||
/// Represents the state of the Umbraco runtime.
|
||||
/// </summary>
|
||||
internal class RuntimeState : IRuntimeState
|
||||
public class RuntimeState : IRuntimeState
|
||||
{
|
||||
private readonly ILogger _logger;
|
||||
private readonly IUmbracoSettingsSection _settings;
|
||||
@@ -105,7 +105,7 @@ namespace Umbraco.Core
|
||||
/// <summary>
|
||||
/// Ensures that the <see cref="ApplicationUrl"/> property has a value.
|
||||
/// </summary>
|
||||
internal void EnsureApplicationUrl()
|
||||
public void EnsureApplicationUrl()
|
||||
{
|
||||
//Fixme: This causes problems with site swap on azure because azure pre-warms a site by calling into `localhost` and when it does that
|
||||
// it changes the URL to `localhost:80` which actually doesn't work for pinging itself, it only works internally in Azure. The ironic part
|
||||
@@ -11,7 +11,7 @@ using Umbraco.Core.Services;
|
||||
|
||||
namespace Umbraco.Core.Security
|
||||
{
|
||||
internal class ContentPermissionsHelper
|
||||
public class ContentPermissionsHelper
|
||||
{
|
||||
public enum ContentAccess
|
||||
{
|
||||
@@ -216,7 +216,7 @@ namespace Umbraco.Core.Security
|
||||
return startNodeIds.Any(x => formattedPath.Contains(string.Concat(",", x, ",")));
|
||||
}
|
||||
|
||||
internal static bool IsInBranchOfStartNode(string path, int[] startNodeIds, string[] startNodePaths, out bool hasPathAccess)
|
||||
public static bool IsInBranchOfStartNode(string path, int[] startNodeIds, string[] startNodePaths, out bool hasPathAccess)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(path)) throw new ArgumentException("Value cannot be null or whitespace.", nameof(path));
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="LightInject" Version="6.2.0" />
|
||||
<PackageReference Include="LightInject.Annotation" Version="1.1.0" />
|
||||
<PackageReference Include="LightInject.Web" Version="2.0.0" />
|
||||
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
|
||||
<PackageReference Include="Microsoft.Owin" Version="4.0.1" />
|
||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-19554-01" />
|
||||
|
||||
@@ -14,6 +14,7 @@ using Umbraco.Core;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.Membership;
|
||||
@@ -84,7 +85,9 @@ namespace Umbraco.Tests.Web.Controllers
|
||||
Factory.GetInstance<AppCaches>(),
|
||||
Factory.GetInstance<IProfilingLogger>(),
|
||||
Factory.GetInstance<IRuntimeState>(),
|
||||
helper);
|
||||
helper,
|
||||
Factory.GetInstance<IMediaFileSystem>()
|
||||
);
|
||||
return usersController;
|
||||
}
|
||||
|
||||
@@ -148,7 +151,8 @@ namespace Umbraco.Tests.Web.Controllers
|
||||
Factory.GetInstance<AppCaches>(),
|
||||
Factory.GetInstance<IProfilingLogger>(),
|
||||
Factory.GetInstance<IRuntimeState>(),
|
||||
helper);
|
||||
helper,
|
||||
Factory.GetInstance<IMediaFileSystem>());
|
||||
return usersController;
|
||||
}
|
||||
|
||||
@@ -183,7 +187,8 @@ namespace Umbraco.Tests.Web.Controllers
|
||||
Factory.GetInstance<AppCaches>(),
|
||||
Factory.GetInstance<IProfilingLogger>(),
|
||||
Factory.GetInstance<IRuntimeState>(),
|
||||
helper);
|
||||
helper,
|
||||
Factory.GetInstance<IMediaFileSystem>());
|
||||
return usersController;
|
||||
}
|
||||
|
||||
@@ -253,7 +258,8 @@ namespace Umbraco.Tests.Web.Controllers
|
||||
Factory.GetInstance<AppCaches>(),
|
||||
Factory.GetInstance<IProfilingLogger>(),
|
||||
Factory.GetInstance<IRuntimeState>(),
|
||||
helper);
|
||||
helper,
|
||||
Factory.GetInstance<IMediaFileSystem>());
|
||||
return usersController;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,11 @@ using Umbraco.Web.WebApi;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Web.Security;
|
||||
using Umbraco.Web.WebApi.Filters;
|
||||
|
||||
@@ -24,6 +29,23 @@ namespace Umbraco.Web.Editors
|
||||
[PluginController("UmbracoApi")]
|
||||
public class CurrentUserController : UmbracoAuthorizedJsonController
|
||||
{
|
||||
private readonly IMediaFileSystem _mediaFileSystem;
|
||||
|
||||
public CurrentUserController(
|
||||
IGlobalSettings globalSettings,
|
||||
IUmbracoContextAccessor umbracoContextAccessor,
|
||||
ISqlContext sqlContext,
|
||||
ServiceContext services,
|
||||
AppCaches appCaches,
|
||||
IProfilingLogger logger,
|
||||
IRuntimeState runtimeState,
|
||||
UmbracoHelper umbracoHelper,
|
||||
IMediaFileSystem mediaFileSystem)
|
||||
: base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
|
||||
{
|
||||
_mediaFileSystem = mediaFileSystem;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns permissions for all nodes passed in for the current user
|
||||
/// </summary>
|
||||
@@ -155,7 +177,7 @@ namespace Umbraco.Web.Editors
|
||||
public async Task<HttpResponseMessage> PostSetAvatar()
|
||||
{
|
||||
//borrow the logic from the user controller
|
||||
return await UsersController.PostSetAvatarInternal(Request, Services.UserService, AppCaches.RuntimeCache, Security.GetUserId().ResultOr(0));
|
||||
return await UsersController.PostSetAvatarInternal(Request, Services.UserService, AppCaches.RuntimeCache, _mediaFileSystem, Security.GetUserId().ResultOr(0));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -2,7 +2,13 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Web.Models.ContentEditing;
|
||||
using Umbraco.Web.Mvc;
|
||||
using Umbraco.Web.WebApi.Filters;
|
||||
@@ -15,6 +21,23 @@ namespace Umbraco.Web.Editors
|
||||
[PluginController("UmbracoApi")]
|
||||
public class LogController : UmbracoAuthorizedJsonController
|
||||
{
|
||||
private readonly IMediaFileSystem _mediaFileSystem;
|
||||
|
||||
public LogController(
|
||||
IGlobalSettings globalSettings,
|
||||
IUmbracoContextAccessor umbracoContextAccessor,
|
||||
ISqlContext sqlContext,
|
||||
ServiceContext services,
|
||||
AppCaches appCaches,
|
||||
IProfilingLogger logger,
|
||||
IRuntimeState runtimeState,
|
||||
UmbracoHelper umbracoHelper,
|
||||
IMediaFileSystem mediaFileSystem)
|
||||
: base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
|
||||
{
|
||||
_mediaFileSystem = mediaFileSystem;
|
||||
}
|
||||
|
||||
[UmbracoApplicationAuthorize(Core.Constants.Applications.Content, Core.Constants.Applications.Media)]
|
||||
public PagedResult<AuditLog> GetPagedEntityLog(int id,
|
||||
int pageNumber = 1,
|
||||
@@ -67,7 +90,7 @@ namespace Umbraco.Web.Editors
|
||||
var mappedItems = items.ToList();
|
||||
var userIds = mappedItems.Select(x => x.UserId).ToArray();
|
||||
var userAvatars = Services.UserService.GetUsersById(userIds)
|
||||
.ToDictionary(x => x.Id, x => x.GetUserAvatarUrls(AppCaches.RuntimeCache));
|
||||
.ToDictionary(x => x.Id, x => x.GetUserAvatarUrls(AppCaches.RuntimeCache, _mediaFileSystem));
|
||||
var userNames = Services.UserService.GetUsersById(userIds).ToDictionary(x => x.Id, x => x.Name);
|
||||
foreach (var item in mappedItems)
|
||||
{
|
||||
|
||||
@@ -15,6 +15,7 @@ using Umbraco.Core;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.Editors;
|
||||
@@ -41,11 +42,13 @@ namespace Umbraco.Web.Editors
|
||||
public class UsersController : UmbracoAuthorizedJsonController
|
||||
{
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly IMediaFileSystem _mediaFileSystem;
|
||||
|
||||
public UsersController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper)
|
||||
public UsersController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper, IMediaFileSystem mediaFileSystem)
|
||||
: base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
|
||||
{
|
||||
_globalSettings = globalSettings;
|
||||
_mediaFileSystem = mediaFileSystem;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -54,7 +57,7 @@ namespace Umbraco.Web.Editors
|
||||
/// <returns></returns>
|
||||
public string[] GetCurrentUserAvatarUrls()
|
||||
{
|
||||
var urls = UmbracoContext.Security.CurrentUser.GetUserAvatarUrls(AppCaches.RuntimeCache);
|
||||
var urls = UmbracoContext.Security.CurrentUser.GetUserAvatarUrls(AppCaches.RuntimeCache, _mediaFileSystem);
|
||||
if (urls == null)
|
||||
throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Could not access Gravatar endpoint"));
|
||||
|
||||
@@ -66,10 +69,10 @@ namespace Umbraco.Web.Editors
|
||||
[AdminUsersAuthorize]
|
||||
public async Task<HttpResponseMessage> PostSetAvatar(int id)
|
||||
{
|
||||
return await PostSetAvatarInternal(Request, Services.UserService, AppCaches.RuntimeCache, id);
|
||||
return await PostSetAvatarInternal(Request, Services.UserService, AppCaches.RuntimeCache, _mediaFileSystem, id);
|
||||
}
|
||||
|
||||
internal static async Task<HttpResponseMessage> PostSetAvatarInternal(HttpRequestMessage request, IUserService userService, IAppCache cache, int id)
|
||||
internal static async Task<HttpResponseMessage> PostSetAvatarInternal(HttpRequestMessage request, IUserService userService, IAppCache cache, IMediaFileSystem mediaFileSystem, int id)
|
||||
{
|
||||
if (request.Content.IsMimeMultipartContent() == false)
|
||||
{
|
||||
@@ -123,7 +126,7 @@ namespace Umbraco.Web.Editors
|
||||
});
|
||||
}
|
||||
|
||||
return request.CreateResponse(HttpStatusCode.OK, user.GetUserAvatarUrls(cache));
|
||||
return request.CreateResponse(HttpStatusCode.OK, user.GetUserAvatarUrls(cache, mediaFileSystem));
|
||||
}
|
||||
|
||||
[AppendUserModifiedHeader("id")]
|
||||
@@ -157,7 +160,7 @@ namespace Umbraco.Web.Editors
|
||||
Current.MediaFileSystem.DeleteFile(filePath);
|
||||
}
|
||||
|
||||
return Request.CreateResponse(HttpStatusCode.OK, found.GetUserAvatarUrls(AppCaches.RuntimeCache));
|
||||
return Request.CreateResponse(HttpStatusCode.OK, found.GetUserAvatarUrls(AppCaches.RuntimeCache, _mediaFileSystem));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -6,6 +6,7 @@ using Umbraco.Core;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Composing;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.IO;
|
||||
using Umbraco.Core.Mapping;
|
||||
using Umbraco.Core.Models.Membership;
|
||||
using Umbraco.Web.Models.ContentEditing;
|
||||
@@ -27,9 +28,10 @@ namespace Umbraco.Web.Models.Mapping
|
||||
private readonly ActionCollection _actions;
|
||||
private readonly AppCaches _appCaches;
|
||||
private readonly IGlobalSettings _globalSettings;
|
||||
private readonly IMediaFileSystem _mediaFileSystem;
|
||||
|
||||
public UserMapDefinition(ILocalizedTextService textService, IUserService userService, IEntityService entityService, ISectionService sectionService,
|
||||
AppCaches appCaches, ActionCollection actions, IGlobalSettings globalSettings)
|
||||
AppCaches appCaches, ActionCollection actions, IGlobalSettings globalSettings, IMediaFileSystem mediaFileSystem)
|
||||
{
|
||||
_sectionService = sectionService;
|
||||
_entityService = entityService;
|
||||
@@ -38,6 +40,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
_actions = actions;
|
||||
_appCaches = appCaches;
|
||||
_globalSettings = globalSettings;
|
||||
_mediaFileSystem = mediaFileSystem;
|
||||
}
|
||||
|
||||
public void DefineMaps(UmbracoMapper mapper)
|
||||
@@ -273,7 +276,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
private void Map(IUser source, UserDisplay target, MapperContext context)
|
||||
{
|
||||
target.AvailableCultures = _textService.GetSupportedCultures().ToDictionary(x => x.Name, x => x.DisplayName);
|
||||
target.Avatars = source.GetUserAvatarUrls(_appCaches.RuntimeCache);
|
||||
target.Avatars = source.GetUserAvatarUrls(_appCaches.RuntimeCache, _mediaFileSystem);
|
||||
target.CalculatedStartContentIds = GetStartNodes(source.CalculateContentStartNodeIds(_entityService), UmbracoObjectTypes.Document, "content/contentRoot", context);
|
||||
target.CalculatedStartMediaIds = GetStartNodes(source.CalculateMediaStartNodeIds(_entityService), UmbracoObjectTypes.Media, "media/mediaRoot", context);
|
||||
target.CreateDate = source.CreateDate;
|
||||
@@ -304,7 +307,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
//Loading in the user avatar's requires an external request if they don't have a local file avatar, this means that initial load of paging may incur a cost
|
||||
//Alternatively, if this is annoying the back office UI would need to be updated to request the avatars for the list of users separately so it doesn't look
|
||||
//like the load time is waiting.
|
||||
target.Avatars = source.GetUserAvatarUrls(_appCaches.RuntimeCache);
|
||||
target.Avatars = source.GetUserAvatarUrls(_appCaches.RuntimeCache, _mediaFileSystem);
|
||||
target.Culture = source.GetUserCulture(_textService, _globalSettings).ToString();
|
||||
target.Email = source.Email;
|
||||
target.EmailHash = source.Email.ToLowerInvariant().Trim().GenerateHash();
|
||||
@@ -323,7 +326,7 @@ namespace Umbraco.Web.Models.Mapping
|
||||
private void Map(IUser source, UserDetail target, MapperContext context)
|
||||
{
|
||||
target.AllowedSections = source.AllowedSections;
|
||||
target.Avatars = source.GetUserAvatarUrls(_appCaches.RuntimeCache);
|
||||
target.Avatars = source.GetUserAvatarUrls(_appCaches.RuntimeCache, _mediaFileSystem);
|
||||
target.Culture = source.GetUserCulture(_textService, _globalSettings).ToString();
|
||||
target.Email = source.Email;
|
||||
target.EmailHash = source.Email.ToLowerInvariant().Trim().GenerateHash();
|
||||
|
||||
Reference in New Issue
Block a user