Open jeremy-farrance opened 3 months ago
This appears to be the winner on simplicity, readability, performance, and accuracy.
<%
// is the current page public?
// retry using PortalSettings.ActiveTab.TabPermissions
int allUsersRoleId = int.Parse(DotNetNuke.Common.Globals.glbRoleAllUsers);
bool IsPublic = PortalSettings.ActiveTab
.TabPermissions.Cast<DotNetNuke.Security.Permissions.TabPermissionInfo>()
.Any(pi => pi.RoleID == allUsersRoleId
&& pi.AllowAccess
&& pi.PermissionID == 3 // 3 is SYSTEM_TAB, VIEW
)
;
debugOutput.AppendLine("--------------------");
debugOutput.AppendLine($"IsPublic: {IsPublic}");
debugOutput.AppendLine($"allUsersRoleId: {allUsersRoleId}");
%>
Probably should have posted this here for best long-term availability. https://github.com/Accuraty/AccuTheme-Bs4/issues/19