Skip to content

Commit

Permalink
Merge pull request #5118 from DanielBolef/top-level-pages
Browse files Browse the repository at this point in the history
Top level pages
  • Loading branch information
mitchelsellers authored Jul 24, 2022
2 parents 327b1f5 + 3f7dbe5 commit 7a34b6f
Show file tree
Hide file tree
Showing 22 changed files with 1,042 additions and 31 deletions.
11 changes: 10 additions & 1 deletion DNN Platform/Library/Common/Utilities/DataCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ public class DataCache

public const string PortalGroupsCacheKey = "PortalGroups";
public const CacheItemPriority PortalGroupsCachePriority = CacheItemPriority.High;
public const int PortalGroupsCacheTimeOut = 20;
public const int PortalGroupsCacheTimeOut = 20;

public const string PortalPermissionCacheKey = "PortalPermission{0}";
public const CacheItemPriority PortalPermissionCachePriority = CacheItemPriority.High;
public const int PortalPermissionCacheTimeOut = 20;

// Tab cache keys
public const string TabCacheKey = "Tab_Tabs{0}";
Expand Down Expand Up @@ -434,6 +438,11 @@ public static void ClearTabPermissionsCache(int PortalId)
RemoveCache(string.Format(TabPermissionCacheKey, PortalId));
}

public static void ClearPortalPermissionsCache(int PortalId)
{
RemoveCache(string.Format(PortalPermissionCacheKey, PortalId));
}

public static void ClearUserCache(int PortalId, string username)
{
RemoveCache(string.Format(UserCacheKey, PortalId, username));
Expand Down
32 changes: 32 additions & 0 deletions DNN Platform/Library/Data/DataProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1843,6 +1843,38 @@ public virtual int AddFolderPermission(int folderId, int permissionId, int roleI
allowAccess,
this.GetNull(userId),
createdByUserID);
}

public virtual IDataReader GetPortalPermissionsByPortal(int portalId)
{
return this.ExecuteReader("GetPortalPermissionsByPortal", this.GetNull(portalId));
}

public virtual int AddPortalPermission(int portalId, int permissionId, int roleId, bool allowAccess, int userId, int createdByUserId)
{
return this.ExecuteScalar<int>(
"SaveTabPermission",
portalId,
permissionId,
this.GetRoleNull(roleId),
allowAccess,
this.GetNull(userId),
createdByUserId);
}

public virtual void DeletePortalPermission(int portalPermissionId)
{
this.ExecuteNonQuery("DeletePortalPermission", portalPermissionId);
}

public virtual void DeletePortalPermissionsByPortalID(int portalId)
{
this.ExecuteNonQuery("DeletePortalPermissionsByPortalID", portalId);
}

public virtual void DeletePortalPermissionsByUserID(int portalId, int userId)
{
this.ExecuteNonQuery("DeletePortalPermissionsByUserID", portalId, userId);
}

public virtual void DeleteFolderPermission(int folderPermissionId)
Expand Down
4 changes: 4 additions & 0 deletions DNN Platform/Library/DotNetNuke.Library.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -681,8 +681,12 @@
<Compile Include="Security\Cookies\PersistedAuthCookie.cs" />
<Compile Include="Security\FIPSCompliant.cs" />
<Compile Include="Security\Membership\AspNetMembershipProvider.cs" />
<Compile Include="Security\Permissions\ComparePortalPermissions.cs" />
<Compile Include="Security\Permissions\CorePermissionProvider.cs" />
<Compile Include="Security\Permissions\IFolderPermissionController.cs" />
<Compile Include="Security\Permissions\PortalPermissionController.cs" />
<Compile Include="Security\Permissions\PortalPermissionInfo.cs" />
<Compile Include="Security\Permissions\PortalPermissionCollection.cs" />
<Compile Include="Security\Profile\DNNProfileProvider.cs" />
<Compile Include="Security\RegistrationSettings.cs" />
<Compile Include="Security\Roles\DNNRoleProvider.cs" />
Expand Down
13 changes: 13 additions & 0 deletions DNN Platform/Library/Entities/Portals/PortalInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace DotNetNuke.Entities.Portals
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Tabs;
using DotNetNuke.Entities.Users;
using DotNetNuke.Security.Permissions;
using DotNetNuke.Security.Roles;

/// <summary>
Expand Down Expand Up @@ -55,6 +56,7 @@ public class PortalInfo : BaseEntityInfo, IHydratable, IPortalInfo
private string _administratorRoleName;
private int _pages = Null.NullInteger;
private string _registeredRoleName;
private PortalPermissionCollection permissions;

private int _users;

Expand Down Expand Up @@ -226,6 +228,17 @@ public int PortalID
set => this.ThisAsInterface.PortalId = value;
}

/// <summary>Gets the permissions collection for the portal.</summary>
[XmlArray("portalpermissions")]
[XmlArrayItem("permission")]
public PortalPermissionCollection PortalPermissions
{
get
{
return this.permissions ?? (this.permissions = new PortalPermissionCollection(PortalPermissionController.GetPortalPermissions(this.ThisAsInterface.PortalId)));
}
}

/// <inheritdoc />
int IPortalInfo.PortalGroupId { get; set; }

Expand Down
5 changes: 4 additions & 1 deletion DNN Platform/Library/Obsolete/EventLogController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,10 @@ public enum EventLogType
WEBSERVER_DISABLED = 150,
WEBSERVER_ENABLED = 151,
WEBSERVER_PINGFAILED = 152,
FOLDER_MOVED = 153,
FOLDER_MOVED = 153,
PORTALPERMISSION_DELETED = 154,
PORTALPERMISSION_CREATED = 155,
PORTALPERMISSION_UPDATED = 156,
}

[Obsolete("Deprecated in 9.8.0. Use Dependency Injection to resolve 'DotNetNuke.Abstractions.Logging.IEventLogger' instead. Scheduled for removal in v11.0.0.")]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// 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 DotNetNuke.Security.Permissions
{
using System.Collections;

/// -----------------------------------------------------------------------------
/// Project : DotNetNuke
/// Namespace: DotNetNuke.Security.Permissions
/// Class : ComparePortalPermissions
/// -----------------------------------------------------------------------------
/// <summary>
/// ComparePortalPermissions provides the a custom IComparer implementation for
/// PortalPermissionInfo objects.
/// </summary>
/// -----------------------------------------------------------------------------
internal class ComparePortalPermissions : IComparer
{
/// <inheritdoc/>
public int Compare(object x, object y)
{
return ((PortalPermissionInfo)x).PortalPermissionID.CompareTo(((PortalPermissionInfo)y).PortalPermissionID);
}
}
}
Loading

0 comments on commit 7a34b6f

Please sign in to comment.