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:
@@ -26,6 +26,9 @@ using Umbraco.Core.Models.Validation;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Persistence.Querying;
|
||||
using Umbraco.Core.PropertyEditors;
|
||||
using Umbraco.Core.Security;
|
||||
using Umbraco.Web.ContentApps;
|
||||
using Umbraco.Web.WebApi.Filters;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Core.Strings;
|
||||
using Umbraco.Extensions;
|
||||
@@ -55,7 +58,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
private readonly IMediaTypeService _mediaTypeService;
|
||||
private readonly IMediaService _mediaService;
|
||||
private readonly IEntityService _entityService;
|
||||
private readonly IWebSecurity _webSecurity;
|
||||
private readonly IBackofficeSecurityAccessor _backofficeSecurityAccessor;
|
||||
private readonly UmbracoMapper _umbracoMapper;
|
||||
private readonly IDataTypeService _dataTypeService;
|
||||
private readonly ILocalizedTextService _localizedTextService;
|
||||
@@ -74,7 +77,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
IMediaTypeService mediaTypeService,
|
||||
IMediaService mediaService,
|
||||
IEntityService entityService,
|
||||
IWebSecurity webSecurity,
|
||||
IBackofficeSecurityAccessor backofficeSecurityAccessor,
|
||||
UmbracoMapper umbracoMapper,
|
||||
IDataTypeService dataTypeService,
|
||||
ISqlContext sqlContext,
|
||||
@@ -90,7 +93,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
_mediaTypeService = mediaTypeService;
|
||||
_mediaService = mediaService;
|
||||
_entityService = entityService;
|
||||
_webSecurity = webSecurity;
|
||||
_backofficeSecurityAccessor = backofficeSecurityAccessor;
|
||||
_umbracoMapper = umbracoMapper;
|
||||
_dataTypeService = dataTypeService;
|
||||
_localizedTextService = localizedTextService;
|
||||
@@ -118,7 +121,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
throw new HttpResponseException(HttpStatusCode.NotFound);
|
||||
}
|
||||
|
||||
var emptyContent = _mediaService.CreateMedia("", parentId, contentType.Alias, _webSecurity.GetUserId().ResultOr(Constants.Security.SuperUserId));
|
||||
var emptyContent = _mediaService.CreateMedia("", parentId, contentType.Alias, _backofficeSecurityAccessor.BackofficeSecurity.GetUserId().ResultOr(Constants.Security.SuperUserId));
|
||||
var mapped = _umbracoMapper.Map<MediaItemDisplay>(emptyContent);
|
||||
|
||||
//remove the listview app if it exists
|
||||
@@ -280,7 +283,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
|
||||
protected int[] UserStartNodes
|
||||
{
|
||||
get { return _userStartNodes ?? (_userStartNodes = _webSecurity.CurrentUser.CalculateMediaStartNodeIds(_entityService)); }
|
||||
get { return _userStartNodes ?? (_userStartNodes = _backofficeSecurityAccessor.BackofficeSecurity.CurrentUser.CalculateMediaStartNodeIds(_entityService)); }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -437,7 +440,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
//if the current item is in the recycle bin
|
||||
if (foundMedia.Trashed == false)
|
||||
{
|
||||
var moveResult = _mediaService.MoveToRecycleBin(foundMedia, _webSecurity.GetUserId().ResultOr(Constants.Security.SuperUserId));
|
||||
var moveResult = _mediaService.MoveToRecycleBin(foundMedia, _backofficeSecurityAccessor.BackofficeSecurity.GetUserId().ResultOr(Constants.Security.SuperUserId));
|
||||
if (moveResult == false)
|
||||
{
|
||||
//returning an object of INotificationModel will ensure that any pending
|
||||
@@ -447,7 +450,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
}
|
||||
else
|
||||
{
|
||||
var deleteResult = _mediaService.Delete(foundMedia, _webSecurity.GetUserId().ResultOr(Constants.Security.SuperUserId));
|
||||
var deleteResult = _mediaService.Delete(foundMedia, _backofficeSecurityAccessor.BackofficeSecurity.GetUserId().ResultOr(Constants.Security.SuperUserId));
|
||||
if (deleteResult == false)
|
||||
{
|
||||
//returning an object of INotificationModel will ensure that any pending
|
||||
@@ -471,7 +474,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
var destinationParentID = move.ParentId;
|
||||
var sourceParentID = toMove.ParentId;
|
||||
|
||||
var moveResult = _mediaService.Move(toMove, move.ParentId, _webSecurity.GetUserId().ResultOr(Constants.Security.SuperUserId));
|
||||
var moveResult = _mediaService.Move(toMove, move.ParentId, _backofficeSecurityAccessor.BackofficeSecurity.GetUserId().ResultOr(Constants.Security.SuperUserId));
|
||||
|
||||
if (sourceParentID == destinationParentID)
|
||||
{
|
||||
@@ -545,7 +548,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
}
|
||||
|
||||
//save the item
|
||||
var saveStatus = _mediaService.Save(contentItem.PersistedContent, _webSecurity.GetUserId().ResultOr(Constants.Security.SuperUserId));
|
||||
var saveStatus = _mediaService.Save(contentItem.PersistedContent, _backofficeSecurityAccessor.BackofficeSecurity.GetUserId().ResultOr(Constants.Security.SuperUserId));
|
||||
|
||||
//return the updated model
|
||||
var display = _umbracoMapper.Map<MediaItemDisplay>(contentItem.PersistedContent);
|
||||
@@ -591,7 +594,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
[HttpPost]
|
||||
public IActionResult EmptyRecycleBin()
|
||||
{
|
||||
_mediaService.EmptyRecycleBin(_webSecurity.GetUserId().ResultOr(Constants.Security.SuperUserId));
|
||||
_mediaService.EmptyRecycleBin(_backofficeSecurityAccessor.BackofficeSecurity.GetUserId().ResultOr(Constants.Security.SuperUserId));
|
||||
|
||||
return new UmbracoNotificationSuccessResponse(_localizedTextService.Localize("defaultdialogs/recycleBinIsEmpty"));
|
||||
}
|
||||
@@ -648,7 +651,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
var mediaService = _mediaService;
|
||||
|
||||
var f = mediaService.CreateMedia(folder.Name, parentId.Value, Constants.Conventions.MediaTypes.Folder);
|
||||
mediaService.Save(f, _webSecurity.CurrentUser.Id);
|
||||
mediaService.Save(f, _backofficeSecurityAccessor.BackofficeSecurity.CurrentUser.Id);
|
||||
|
||||
return _umbracoMapper.Map<MediaItemDisplay>(f);
|
||||
}
|
||||
@@ -756,7 +759,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
|
||||
var mediaItemName = fileName.ToFriendlyName();
|
||||
|
||||
var f = mediaService.CreateMedia(mediaItemName, parentId.Value, mediaType, _webSecurity.CurrentUser.Id);
|
||||
var f = mediaService.CreateMedia(mediaItemName, parentId.Value, mediaType, _backofficeSecurityAccessor.BackofficeSecurity.CurrentUser.Id);
|
||||
|
||||
|
||||
await using (var stream = formFile.OpenReadStream())
|
||||
@@ -765,7 +768,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
}
|
||||
|
||||
|
||||
var saveResult = mediaService.Save(f, _webSecurity.CurrentUser.Id);
|
||||
var saveResult = mediaService.Save(f, _backofficeSecurityAccessor.BackofficeSecurity.CurrentUser.Id);
|
||||
if (saveResult == false)
|
||||
{
|
||||
AddCancelMessage(tempFiles,
|
||||
@@ -858,7 +861,7 @@ namespace Umbraco.Web.BackOffice.Controllers
|
||||
//ensure the user has access to this folder by parent id!
|
||||
if (validatePermissions && CheckPermissions(
|
||||
new Dictionary<object, object>(),
|
||||
_webSecurity.CurrentUser,
|
||||
_backofficeSecurityAccessor.BackofficeSecurity.CurrentUser,
|
||||
_mediaService,
|
||||
_entityService,
|
||||
intParentId) == false)
|
||||
|
||||
Reference in New Issue
Block a user