Revert "Start work on allowing nodes for users per language"

This reverts commit e78794c00e.
This commit is contained in:
Nikolaj Geisle
2022-05-11 10:01:27 +02:00
parent 004267a86f
commit b6277fbfd7

View File

@@ -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<ContentTreeControllerBase> 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<ILocalizationService>())
{
}
#region Actions
@@ -562,28 +530,8 @@ namespace Umbraco.Cms.Web.BackOffice.Trees
/// <returns></returns>
internal bool CanUserAccessNode(IUmbracoEntity doc, IEnumerable<MenuItem> 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<ActionBrowse>().Any();
return allowedUserOptions.Select(x => x.Action).OfType<ActionBrowse>().Any();
}