Skip to content

Commit

Permalink
Resolves 9.6.2 logging issue.
Browse files Browse the repository at this point in the history
Closes dnnsoftware#3906

Apparently some files where deleted as part of dnnsoftware#3843

This PR brings those files back and also fixes stylecop warnings. Some class names had to be changed both for clarity and to respect stylecop rule that the file name should match the class name. Because of that change, the dnn manifest was also changed so it all works with the new names.
  • Loading branch information
valadas committed Jul 27, 2020
1 parent 4309c61 commit d8a80f2
Show file tree
Hide file tree
Showing 18 changed files with 367 additions and 93 deletions.
3 changes: 3 additions & 0 deletions DNN Platform/DotNetNuke.Abstractions/INavigationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ namespace DotNetNuke.Abstractions
{
using DotNetNuke.Abstractions.Portals;

/// <summary>
/// Provides navigation services.
/// </summary>
public interface INavigationManager
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -336,14 +336,20 @@
<Compile Include="Components\Vocabularies\VocabulariesController.cs" />
<Compile Include="Data\IUsersDataService.cs" />
<Compile Include="Data\UsersDataService.cs" />
<Compile Include="MenuControllers\AdminMenuController.cs" />
<Compile Include="MenuControllers\AdminLogsMenuController.cs" />
<Compile Include="MenuControllers\ConfigConsoleMenuController.cs" />
<Compile Include="MenuControllers\CssEditorMenuController.cs" />
<Compile Include="MenuControllers\ExtensionMenuController.cs" />
<Compile Include="MenuControllers\HostMenuController.cs" />
<Compile Include="MenuControllers\LicensingMenuController.cs" />
<Compile Include="MenuControllers\PagesMenuController.cs" />
<Compile Include="MenuControllers\PromptMenuController.cs" />
<Compile Include="MenuControllers\SecurityMenuController.cs" />
<Compile Include="MenuControllers\ServersMenuController.cs" />
<Compile Include="MenuControllers\SiteImportExportMenuController.cs" />
<Compile Include="MenuControllers\SiteSettingsMenuController.cs" />
<Compile Include="MenuControllers\SitesMenuController.cs" />
<Compile Include="MenuControllers\SqlConsoleMenuController.cs" />
<Compile Include="MenuControllers\TaskSchedulerMenuController.cs" />
<Compile Include="MenuControllers\ThemeMenuController.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Services\AdminLogsController.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
<menu>
<identifier>Dnn.AdminLogs</identifier>
<moduleName>AdminLogs</moduleName>
<controller>Dnn.PersonaBar.AdminLogs.MenuControllers.AdminMenuController, Dnn.PersonaBar.Extensions</controller>
<controller>Dnn.PersonaBar.AdminLogs.MenuControllers.AdminLogsMenuController, Dnn.PersonaBar.Extensions</controller>
<resourceKey>nav_AdminLogs</resourceKey>
<path>AdminLogs</path>
<parent>Manage</parent>
Expand Down Expand Up @@ -120,7 +120,7 @@
<menu>
<identifier>Dnn.ConfigConsole</identifier>
<moduleName>ConfigConsole</moduleName>
<controller>Dnn.PersonaBar.ConfigConsole.MenuControllers.HostMenuController, Dnn.PersonaBar.Extensions</controller>
<controller>Dnn.PersonaBar.ConfigConsole.MenuControllers.ConfigConsoleMenuController, Dnn.PersonaBar.Extensions</controller>
<resourceKey>nav_ConfigConsole</resourceKey>
<path>ConfigConsole</path>
<parent>Settings</parent>
Expand All @@ -142,7 +142,7 @@
<menu>
<identifier>Dnn.CssEditor</identifier>
<moduleName>CssEditor</moduleName>
<controller>Dnn.PersonaBar.CssEditor.MenuControllers.AdminMenuController, Dnn.PersonaBar.Extensions</controller>
<controller>Dnn.PersonaBar.CssEditor.MenuControllers.CssEditorMenuController, Dnn.PersonaBar.Extensions</controller>
<resourceKey>nav_CssEditor</resourceKey>
<path>CssEditor</path>
<parent>Settings</parent>
Expand All @@ -154,7 +154,7 @@
<menu>
<identifier>Dnn.Licensing</identifier>
<moduleName>Licensing</moduleName>
<controller>Dnn.PersonaBar.Licensing.MenuControllers.HostMenuController, Dnn.PersonaBar.Extensions</controller>
<controller>Dnn.PersonaBar.Licensing.MenuControllers.LicensingMenuController, Dnn.PersonaBar.Extensions</controller>
<resourceKey>nav_Licensing</resourceKey>
<path>Licensing</path>
<parent>Settings</parent>
Expand Down Expand Up @@ -193,6 +193,7 @@
<menu>
<identifier>Dnn.Prompt</identifier>
<moduleName>Prompt</moduleName>
<controller>Dnn.PersonaBar.Prompt.MenuControllers.PromptMenuController, Dnn.PersonaBar.Extensions</controller>
<resourceKey>nav_Prompt</resourceKey>
<path>Prompt</path>
<parent>Settings</parent>
Expand Down Expand Up @@ -277,7 +278,7 @@
<menu>
<identifier>Dnn.Sites</identifier>
<moduleName>Sites</moduleName>
<controller>Dnn.PersonaBar.Sites.MenuControllers.AdminMenuController, Dnn.PersonaBar.Extensions</controller>
<controller>Dnn.PersonaBar.Sites.MenuControllers.SitesMenuController, Dnn.PersonaBar.Extensions</controller>
<resourceKey>nav_Sites</resourceKey>
<path>Sites</path>
<parent>Manage</parent>
Expand Down Expand Up @@ -323,7 +324,7 @@
<menu>
<identifier>Dnn.SiteImportExport</identifier>
<moduleName>SiteImportExport</moduleName>
<controller>Dnn.PersonaBar.SiteImportExport.MenuControllers.AdminMenuController, Dnn.PersonaBar.Extensions</controller>
<controller>Dnn.PersonaBar.SiteImportExport.MenuControllers.SiteImportExportMenuController, Dnn.PersonaBar.Extensions</controller>
<resourceKey>nav_SiteImportExport</resourceKey>
<path>SiteImportExport</path>
<parent>Settings</parent>
Expand Down Expand Up @@ -355,7 +356,7 @@
<menu>
<identifier>Dnn.SqlConsole</identifier>
<moduleName>SqlConsole</moduleName>
<controller>Dnn.PersonaBar.SqlConsole.MenuControllers.HostMenuController, Dnn.PersonaBar.Extensions</controller>
<controller>Dnn.PersonaBar.SqlConsole.MenuControllers.SqlConsoleMenuController, Dnn.PersonaBar.Extensions</controller>
<resourceKey>nav_SqlConsole</resourceKey>
<path>SqlConsole</path>
<parent>Settings</parent>
Expand All @@ -366,7 +367,7 @@
<menu>
<identifier>Dnn.TaskScheduler</identifier>
<moduleName>TaskScheduler</moduleName>
<controller>Dnn.PersonaBar.TaskScheduler.MenuControllers.HostMenuController, Dnn.PersonaBar.Extensions</controller>
<controller>Dnn.PersonaBar.TaskScheduler.MenuControllers.TaskSchedulerMenuController, Dnn.PersonaBar.Extensions</controller>
<resourceKey>nav_TaskScheduler</resourceKey>
<path>TaskScheduler</path>
<parent>Settings</parent>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information

namespace Dnn.PersonaBar.AdminLogs.MenuControllers
{
using System.Collections.Generic;

using Dnn.PersonaBar.Library.Controllers;
using Dnn.PersonaBar.Library.Model;

/// <summary>
/// Controls the admin logs menu.
/// </summary>
public class AdminLogsMenuController : IMenuItemController
{
/// <inheritdoc/>
public void UpdateParameters(MenuItem menuItem)
{
}

/// <inheritdoc/>
public bool Visible(MenuItem menuItem)
{
return true;
}

/// <inheritdoc/>
public IDictionary<string, object> GetSettings(MenuItem menuItem)
{
var settings = new Dictionary<string, object>();
return settings;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information

// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information

namespace Dnn.PersonaBar.ConfigConsole.MenuControllers
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


using Dnn.PersonaBar.Library.Controllers;
using Dnn.PersonaBar.Library.Model;
using DotNetNuke.Entities.Portals;
using DotNetNuke.Entities.Users;

public class HostMenuController : IMenuItemController

/// <summary>
/// Controls the config console menu.
/// </summary>
public class ConfigConsoleMenuController : IMenuItemController
{
/// <inheritdoc/>
public void UpdateParameters(MenuItem menuItem)
{

}

/// <inheritdoc/>
public bool Visible(MenuItem menuItem)
{
var user = UserController.Instance.GetCurrentUserInfo();
return user.IsSuperUser;
}

/// <inheritdoc/>
public IDictionary<string, object> GetSettings(MenuItem menuItem)
{
return null;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information

namespace Dnn.PersonaBar.CssEditor.MenuControllers
{
using System.Collections.Generic;

using Dnn.PersonaBar.Library.Controllers;
using Dnn.PersonaBar.Library.Model;
using DotNetNuke.Entities.Portals;
using DotNetNuke.Entities.Users;

/// <summary>
/// Controls the css editor menu.
/// </summary>
public class CssEditorMenuController : IMenuItemController
{
/// <inheritdoc/>
public void UpdateParameters(MenuItem menuItem)
{
}

/// <inheritdoc/>
public bool Visible(MenuItem menuItem)
{
var user = UserController.Instance.GetCurrentUserInfo();
return user.IsSuperUser || user.IsInRole(PortalSettings.Current?.AdministratorRoleName);
}

/// <inheritdoc/>
public IDictionary<string, object> GetSettings(MenuItem menuItem)
{
return null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,37 @@ namespace Dnn.PersonaBar.Extensions.MenuControllers
using DotNetNuke.Entities.Users;
using Microsoft.Extensions.DependencyInjection;

/// <summary>
/// Controls the extensions menu.
/// </summary>
public class ExtensionMenuController : IMenuItemController
{
/// <summary>
/// Initializes a new instance of the <see cref="ExtensionMenuController"/> class.
/// </summary>
public ExtensionMenuController()
{
this.NavigationManager = Globals.DependencyProvider.GetRequiredService<INavigationManager>();
}

protected INavigationManager NavigationManager { get; }

}

/// <summary>
/// Gets an <see cref="INavigationManager"/> instance to provide navigation services.
/// </summary>
protected INavigationManager NavigationManager { get; }

/// <inheritdoc/>
public void UpdateParameters(MenuItem menuItem)
{
}

}

/// <inheritdoc/>
public bool Visible(MenuItem menuItem)
{
var user = UserController.Instance.GetCurrentUserInfo();
return user.IsSuperUser || user.IsInRole(PortalSettings.Current?.AdministratorRoleName);
}

}

/// <inheritdoc/>
public IDictionary<string, object> GetSettings(MenuItem menuItem)
{
var settings = new Dictionary<string, object>();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information

namespace Dnn.PersonaBar.Licensing.MenuControllers
{
using System.Collections.Generic;

using Dnn.PersonaBar.Library.Controllers;
using Dnn.PersonaBar.Library.Model;
using DotNetNuke.Entities.Users;

/// <summary>
/// Controls the licensing menu.
/// </summary>
public class LicensingMenuController : IMenuItemController
{
/// <inheritdoc/>
public void UpdateParameters(MenuItem menuItem)
{
}

/// <inheritdoc/>
public bool Visible(MenuItem menuItem)
{
var user = UserController.Instance.GetCurrentUserInfo();
return user.IsSuperUser;
}

/// <inheritdoc/>
public IDictionary<string, object> GetSettings(MenuItem menuItem)
{
return null;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,46 +5,52 @@
namespace Dnn.PersonaBar.Pages.MenuControllers
{
using System.Collections.Generic;
using System.Linq;

using Dnn.PersonaBar.Library.Controllers;
using Dnn.PersonaBar.Library.Model;
using Dnn.PersonaBar.Library.Permissions;
using Dnn.PersonaBar.Pages.Components.Security;
using DotNetNuke.Application;
using DotNetNuke.Entities.Portals;

/// <summary>
/// Controls the pages menu.
/// </summary>
public class PagesMenuController : IMenuItemController
{
private readonly ISecurityService _securityService;

private readonly ISecurityService securityService;

/// <summary>
/// Initializes a new instance of the <see cref="PagesMenuController"/> class.
/// </summary>
public PagesMenuController()
{
this._securityService = SecurityService.Instance;
}

this.securityService = SecurityService.Instance;
}

/// <inheritdoc/>
public void UpdateParameters(MenuItem menuItem)
{

}

}

/// <inheritdoc/>
public bool Visible(MenuItem menuItem)
{
return this._securityService.IsVisible(menuItem);
}

return this.securityService.IsVisible(menuItem);
}

/// <inheritdoc/>
public IDictionary<string, object> GetSettings(MenuItem menuItem)
{
var settings = new Dictionary<string, object>
{
{"canSeePagesList", this._securityService.CanViewPageList(menuItem.MenuId)},
{"portalName", PortalSettings.Current.PortalName},
{"currentPagePermissions", this._securityService.GetCurrentPagePermissions()},
{"currentPageName", PortalSettings.Current?.ActiveTab?.TabName},
{"productSKU", DotNetNukeContext.Current.Application.SKU},
{"isAdmin", this._securityService.IsPageAdminUser()},
{"currentParentHasChildren", PortalSettings.Current?.ActiveTab?.HasChildren},
{"isAdminHostSystemPage", this._securityService.IsAdminHostSystemPage() }
{ "canSeePagesList", this.securityService.CanViewPageList(menuItem.MenuId) },
{ "portalName", PortalSettings.Current.PortalName },
{ "currentPagePermissions", this.securityService.GetCurrentPagePermissions() },
{ "currentPageName", PortalSettings.Current?.ActiveTab?.TabName },
{ "productSKU", DotNetNukeContext.Current.Application.SKU },
{ "isAdmin", this.securityService.IsPageAdminUser() },
{ "currentParentHasChildren", PortalSettings.Current?.ActiveTab?.HasChildren },
{ "isAdminHostSystemPage", this.securityService.IsAdminHostSystemPage() },
};

return settings;
Expand Down
Loading

0 comments on commit d8a80f2

Please sign in to comment.