Merge remote-tracking branch 'origin/netcore/netcore' into netcore/feature/migrate-logging

# Conflicts:
#	src/Umbraco.Infrastructure/Scheduling/ScheduledPublishing.cs
#	src/Umbraco.Infrastructure/Scheduling/SchedulerComponent.cs
#	src/Umbraco.Tests.Integration/Umbraco.Web.BackOffice/Filters/ContentModelValidatorTests.cs
#	src/Umbraco.Web.BackOffice/Controllers/BackOfficeController.cs
#	src/Umbraco.Web.BackOffice/Controllers/CurrentUserController.cs
#	src/Umbraco.Web.BackOffice/Controllers/MacrosController.cs
#	src/Umbraco.Web.BackOffice/Controllers/PackageInstallController.cs
#	src/Umbraco.Web.BackOffice/Controllers/RedirectUrlManagementController.cs
#	src/Umbraco.Web.BackOffice/Controllers/UsersController.cs
#	src/Umbraco.Web.BackOffice/Filters/ContentModelValidator.cs
#	src/Umbraco.Web.BackOffice/Filters/ContentSaveModelValidator.cs
#	src/Umbraco.Web.BackOffice/Filters/ContentSaveValidationAttribute.cs
#	src/Umbraco.Web.BackOffice/Filters/MediaItemSaveValidationAttribute.cs
#	src/Umbraco.Web.BackOffice/Filters/MediaSaveModelValidator.cs
#	src/Umbraco.Web.BackOffice/Filters/MemberSaveModelValidator.cs
#	src/Umbraco.Web.BackOffice/Filters/MemberSaveValidationAttribute.cs
#	src/Umbraco.Web.BackOffice/Trees/ContentTreeController.cs
#	src/Umbraco.Web.BackOffice/Trees/ContentTreeControllerBase.cs
#	src/Umbraco.Web.BackOffice/Trees/MediaTreeController.cs
#	src/Umbraco.Web.Common/Install/InstallController.cs
This commit is contained in:
Mole
2020-09-22 13:44:22 +02:00
89 changed files with 741 additions and 521 deletions

View File

@@ -25,7 +25,7 @@ namespace Umbraco.Web.Trees
public abstract class ContentTreeControllerBase : TreeController, ITreeNodeController
{
private readonly IEntityService _entityService;
private readonly IWebSecurity _webSecurity;
private readonly IBackofficeSecurityAccessor _backofficeSecurityAccessor;
private readonly ILogger<ContentTreeControllerBase> _logger;
private readonly ActionCollection _actionCollection;
private readonly IUserService _userService;
@@ -38,7 +38,7 @@ namespace Umbraco.Web.Trees
UmbracoApiControllerTypeCollection umbracoApiControllerTypeCollection,
IMenuItemCollectionFactory menuItemCollectionFactory,
IEntityService entityService,
IWebSecurity webSecurity,
IBackofficeSecurityAccessor backofficeSecurityAccessor,
ILogger<ContentTreeControllerBase> logger,
ActionCollection actionCollection,
IUserService userService,
@@ -47,7 +47,7 @@ namespace Umbraco.Web.Trees
: base(localizedTextService, umbracoApiControllerTypeCollection)
{
_entityService = entityService;
_webSecurity = webSecurity;
_backofficeSecurityAccessor = backofficeSecurityAccessor;
_logger = logger;
_actionCollection = actionCollection;
_userService = userService;
@@ -147,12 +147,12 @@ namespace Umbraco.Web.Trees
switch (RecycleBinId)
{
case Constants.System.RecycleBinMedia:
startNodeIds = _webSecurity.CurrentUser.CalculateMediaStartNodeIds(_entityService);
startNodePaths = _webSecurity.CurrentUser.GetMediaStartNodePaths(_entityService);
startNodeIds = _backofficeSecurityAccessor.BackofficeSecurity.CurrentUser.CalculateMediaStartNodeIds(_entityService);
startNodePaths = _backofficeSecurityAccessor.BackofficeSecurity.CurrentUser.GetMediaStartNodePaths(_entityService);
break;
case Constants.System.RecycleBinContent:
startNodeIds = _webSecurity.CurrentUser.CalculateContentStartNodeIds(_entityService);
startNodePaths = _webSecurity.CurrentUser.GetContentStartNodePaths(_entityService);
startNodeIds = _backofficeSecurityAccessor.BackofficeSecurity.CurrentUser.CalculateContentStartNodeIds(_entityService);
startNodePaths = _backofficeSecurityAccessor.BackofficeSecurity.CurrentUser.GetContentStartNodePaths(_entityService);
break;
default:
throw new NotSupportedException("Path access is only determined on content or media");
@@ -196,7 +196,7 @@ namespace Umbraco.Web.Trees
// TODO: in the future we could return a validation statement so we can have some UI to notify the user they don't have access
if (ignoreUserStartNodes == false && HasPathAccess(id, queryStrings) == false)
{
_logger.LogWarning("User {Username} does not have access to node with id {Id}", _webSecurity.CurrentUser.Username, id);
_logger.LogWarning("User {Username} does not have access to node with id {Id}", _backofficeSecurityAccessor.BackofficeSecurity.CurrentUser.Username, id);
return nodes;
}
@@ -312,8 +312,8 @@ namespace Umbraco.Web.Trees
{
if (entity == null) return false;
return RecycleBinId == Constants.System.RecycleBinContent
? _webSecurity.CurrentUser.HasContentPathAccess(entity, _entityService)
: _webSecurity.CurrentUser.HasMediaPathAccess(entity, _entityService);
? _backofficeSecurityAccessor.BackofficeSecurity.CurrentUser.HasContentPathAccess(entity, _entityService)
: _backofficeSecurityAccessor.BackofficeSecurity.CurrentUser.HasMediaPathAccess(entity, _entityService);
}
/// <summary>
@@ -441,7 +441,7 @@ namespace Umbraco.Web.Trees
var deleteAction = _actionCollection.FirstOrDefault(y => y.Letter == ActionDelete.ActionLetter);
if (deleteAction != null)
{
var perms = _webSecurity.CurrentUser.GetPermissions(Constants.System.RecycleBinContentString, _userService);
var perms = _backofficeSecurityAccessor.BackofficeSecurity.CurrentUser.GetPermissions(Constants.System.RecycleBinContentString, _userService);
deleteAllowed = perms.FirstOrDefault(x => x.Contains(deleteAction.Letter)) != null;
}
@@ -492,7 +492,7 @@ namespace Umbraco.Web.Trees
internal IEnumerable<MenuItem> GetAllowedUserMenuItemsForNode(IUmbracoEntity dd)
{
var permissionsForPath = _userService.GetPermissionsForPath(_webSecurity.CurrentUser, dd.Path).GetAllPermissions();
var permissionsForPath = _userService.GetPermissionsForPath(_backofficeSecurityAccessor.BackofficeSecurity.CurrentUser, dd.Path).GetAllPermissions();
return _actionCollection.GetByLetters(permissionsForPath).Select(x => new MenuItem(x));
}