From b6277fbfd731900d5ccdb32f17dbcad0823218cf Mon Sep 17 00:00:00 2001 From: Nikolaj Geisle Date: Wed, 11 May 2022 10:01:27 +0200 Subject: [PATCH] Revert "Start work on allowing nodes for users per language" This reverts commit e78794c00e4155e70bf1945ac64b0d804130b7f6. --- .../Trees/ContentTreeControllerBase.cs | 58 +------------------ 1 file changed, 3 insertions(+), 55 deletions(-) diff --git a/src/Umbraco.Web.BackOffice/Trees/ContentTreeControllerBase.cs b/src/Umbraco.Web.BackOffice/Trees/ContentTreeControllerBase.cs index 3f63128e9f..f0e62f8a66 100644 --- a/src/Umbraco.Web.BackOffice/Trees/ContentTreeControllerBase.cs +++ b/src/Umbraco.Web.BackOffice/Trees/ContentTreeControllerBase.cs @@ -5,7 +5,6 @@ using System.Globalization; using System.Linq; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; using Umbraco.Cms.Core; using Umbraco.Cms.Core.Actions; @@ -17,7 +16,6 @@ using Umbraco.Cms.Core.Models.Trees; using Umbraco.Cms.Core.Security; using Umbraco.Cms.Core.Services; using Umbraco.Cms.Core.Trees; -using Umbraco.Cms.Web.Common.DependencyInjection; using Umbraco.Cms.Web.Common.ModelBinders; using Umbraco.Extensions; using Constants = Umbraco.Cms.Core.Constants; @@ -33,7 +31,6 @@ namespace Umbraco.Cms.Web.BackOffice.Trees private readonly IUserService _userService; private readonly IDataTypeService _dataTypeService; private readonly AppCaches _appCaches; - private readonly ILocalizationService _localizationService; public IMenuItemCollectionFactory MenuItemCollectionFactory { get; } @@ -48,8 +45,8 @@ namespace Umbraco.Cms.Web.BackOffice.Trees IUserService userService, IDataTypeService dataTypeService, IEventAggregator eventAggregator, - AppCaches appCaches, - ILocalizationService localizationService) + AppCaches appCaches + ) : base(localizedTextService, umbracoApiControllerTypeCollection, eventAggregator) { _entityService = entityService; @@ -59,38 +56,9 @@ namespace Umbraco.Cms.Web.BackOffice.Trees _userService = userService; _dataTypeService = dataTypeService; _appCaches = appCaches; - _localizationService = localizationService; MenuItemCollectionFactory = menuItemCollectionFactory; } - protected ContentTreeControllerBase( - ILocalizedTextService localizedTextService, - UmbracoApiControllerTypeCollection umbracoApiControllerTypeCollection, - IMenuItemCollectionFactory menuItemCollectionFactory, - IEntityService entityService, - IBackOfficeSecurityAccessor backofficeSecurityAccessor, - ILogger logger, - ActionCollection actionCollection, - IUserService userService, - IDataTypeService dataTypeService, - IEventAggregator eventAggregator, - AppCaches appCaches) - : this( - localizedTextService, - umbracoApiControllerTypeCollection, - menuItemCollectionFactory, - entityService, - backofficeSecurityAccessor, - logger, - actionCollection, - userService, - dataTypeService, - eventAggregator, - appCaches, - StaticServiceProvider.Instance.GetRequiredService()) - { - } - #region Actions @@ -562,28 +530,8 @@ namespace Umbraco.Cms.Web.BackOffice.Trees /// internal bool CanUserAccessNode(IUmbracoEntity doc, IEnumerable allowedUserOptions, string? culture) { - var userGroups = _backofficeSecurityAccessor.BackOfficeSecurity?.CurrentUser?.Groups; - if (userGroups is null) - { - return false; - } - - bool hasAccess = false; - var language = _localizationService.GetLanguageByIsoCode(culture); - - if (language is null) - { - return false; - } - foreach (var group in userGroups) - { - if (!group.AllowedLanguages.Any() || group.AllowedLanguages.Contains(language.Id)) - { - hasAccess = true; - } - } // TODO: At some stage when we implement permissions on languages we'll need to take care of culture - return hasAccess && allowedUserOptions.Select(x => x.Action).OfType().Any(); + return allowedUserOptions.Select(x => x.Action).OfType().Any(); }