From 802d480a9432c50b147937c6d62a44ebb7165575 Mon Sep 17 00:00:00 2001 From: Rick Harris Date: Thu, 30 May 2019 14:13:58 -0700 Subject: [PATCH 1/3] 7.1.0 - CheckRolesMatch update Implemented a Rolename check to not add a role if the role name is null or empty. --- Source/DnnDocuments/EditDocs.ascx.vb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Source/DnnDocuments/EditDocs.ascx.vb b/Source/DnnDocuments/EditDocs.ascx.vb index c9ea135..221296e 100644 --- a/Source/DnnDocuments/EditDocs.ascx.vb +++ b/Source/DnnDocuments/EditDocs.ascx.vb @@ -272,9 +272,11 @@ Namespace DotNetNuke.Modules.Documents Dim fileRolesList As List(Of PermissionInfoBase) = FileRoles.ToList() Dim fileReadRoles As IEnumerable(Of PermissionInfoBase) = From fileRole In fileRolesList Where fileRole.PermissionKey = "READ" For Each fileRole As FolderPermissionInfo In fileReadRoles - objFileRoles.Add(fileRole.RoleName, fileRole.RoleName) - If fileRole.RoleName = DotNetNuke.Common.Globals.glbRoleAllUsersName Then - Return True + If Not fileRole.RoleName = "" Then + objFileRoles.Add(fileRole.RoleName, fileRole.RoleName) + If fileRole.RoleName = DotNetNuke.Common.Globals.glbRoleAllUsersName Then + Return True + End If End If Next From 3296d3b5b028bc2920fa67cfcf409f7a87a10571 Mon Sep 17 00:00:00 2001 From: Rick Harris Date: Tue, 18 Jun 2019 08:05:42 -0700 Subject: [PATCH 2/3] 7.1.0 - PopulateOwnerList method logic update Updated the logic to pull owner and superuser data to lists, compare and remove data if its a duplicate owner and load the data into the owner dropdown. --- Source/DnnDocuments/EditDocs.ascx.vb | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/Source/DnnDocuments/EditDocs.ascx.vb b/Source/DnnDocuments/EditDocs.ascx.vb index 221296e..6d360e2 100644 --- a/Source/DnnDocuments/EditDocs.ascx.vb +++ b/Source/DnnDocuments/EditDocs.ascx.vb @@ -614,21 +614,14 @@ Namespace DotNetNuke.Modules.Documents End Sub Private Sub PopulateOwnerList() - ' populate owner list - lstOwner.DataSource = UserController.GetUsers(False, False, PortalId).Cast(Of UserInfo).OrderBy(Function(i As UserInfo) i.DisplayName) - - lstOwner.DataTextField = "DisplayName" - lstOwner.DataValueField = "UserId" - - lstOwner.DataBind() - - ' .GetUsers doesn't return super-users, but they can own documents - ' so add them to the list - Dim objSuperUser As DotNetNuke.Entities.Users.UserInfo - For Each objSuperUser In UserController.GetUsers(Null.NullInteger) - lstOwner.Items.Insert(0, New System.Web.UI.WebControls.ListItem(objSuperUser.DisplayName, objSuperUser.UserID.ToString)) - Next - + ' populate owner list + lstOwner.DataSource = UserController.GetUsers(Null.NullInteger).Cast(Of UserInfo).Distinct().OrderBy(Function(i As UserInfo) i.DisplayName) + + lstOwner.DataTextField = "DisplayName" + lstOwner.DataValueField = "UserId" + + lstOwner.DataBind() + lstOwner.Items.Insert(0, New System.Web.UI.WebControls.ListItem(Services.Localization.Localization.GetString("None_Specified"), "-1")) '' End With End Sub From 8d46633fe7f26612f5f2c27f630bfefffb65ecf5 Mon Sep 17 00:00:00 2001 From: Rick Harris Date: Mon, 8 Jul 2019 08:46:19 -0700 Subject: [PATCH 3/3] 7.1.1 - PopulateOwnerList Datasource update Implemented PortalID to Datasource so that users for that specific portal would be populated. --- Source/DnnDocuments/EditDocs.ascx.vb | 134 +++++++++++++-------------- 1 file changed, 67 insertions(+), 67 deletions(-) diff --git a/Source/DnnDocuments/EditDocs.ascx.vb b/Source/DnnDocuments/EditDocs.ascx.vb index 6d360e2..d0bf737 100644 --- a/Source/DnnDocuments/EditDocs.ascx.vb +++ b/Source/DnnDocuments/EditDocs.ascx.vb @@ -1,23 +1,23 @@ -' -' DotNetNukeŽ - http://www.dotnetnuke.com -' Copyright (c) 2002-2011 -' by DotNetNuke Corporation -' -' Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated -' documentation files (the "Software"), to deal in the Software without restriction, including without limitation -' the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and -' to permit persons to whom the Software is furnished to do so, subject to the following conditions: -' -' The above copyright notice and this permission notice shall be included in all copies or substantial portions -' of the Software. -' -' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED -' TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -' THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF -' CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -' DEALINGS IN THE SOFTWARE. -' - +' +' DotNetNukeŽ - http://www.dotnetnuke.com +' Copyright (c) 2002-2011 +' by DotNetNuke Corporation +' +' Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated +' documentation files (the "Software"), to deal in the Software without restriction, including without limitation +' the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and +' to permit persons to whom the Software is furnished to do so, subject to the following conditions: +' +' The above copyright notice and this permission notice shall be included in all copies or substantial portions +' of the Software. +' +' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +' TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +' THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +' CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +' DEALINGS IN THE SOFTWARE. +' + Imports System.IO Imports System.Linq Imports System.Web @@ -40,10 +40,10 @@ Namespace DotNetNuke.Modules.Documents ''' ''' ----------------------------------------------------------------------------- Public MustInherit Class EditDocs - Inherits Entities.Modules.PortalModuleBase - + Inherits Entities.Modules.PortalModuleBase + #Region "Controls" - + Protected WithEvents plName As UI.UserControls.LabelControl Protected WithEvents txtName As System.Web.UI.WebControls.TextBox Protected WithEvents valName As System.Web.UI.WebControls.RequiredFieldValidator @@ -69,29 +69,29 @@ Namespace DotNetNuke.Modules.Documents Protected WithEvents valSortIndex As System.Web.UI.WebControls.RangeValidator Protected WithEvents lblOwner As System.Web.UI.WebControls.Label Protected WithEvents lnkChange As System.Web.UI.WebControls.LinkButton - Protected WithEvents lblAudit As System.Web.UI.WebControls.Label - + Protected WithEvents lblAudit As System.Web.UI.WebControls.Label + #End Region - + #Region "Private Members" - - Private mintItemId As Integer - + + Private mintItemId As Integer + #End Region - + #Region "Event Handlers" - - ''' ----------------------------------------------------------------------------- - ''' - ''' Page_Load runs when the control is loaded - ''' - ''' - ''' - ''' - ''' [cnurse] 9/22/2004 Updated to reflect design changes for Help, 508 support - ''' and localisation - ''' - ''' ----------------------------------------------------------------------------- + + ''' ----------------------------------------------------------------------------- + ''' + ''' Page_Load runs when the control is loaded + ''' + ''' + ''' + ''' + ''' [cnurse] 9/22/2004 Updated to reflect design changes for Help, 508 support + ''' and localisation + ''' + ''' ----------------------------------------------------------------------------- Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim objDocumentsSettings As DocumentsSettingsInfo @@ -246,8 +246,8 @@ Namespace DotNetNuke.Modules.Documents If Not objFile Is Nothing Then ' Get file's folder security Dim moduleRoles As ModulePermissionCollection = ModulePermissionController.GetModulePermissions(ModuleId, TabId) - Dim fileRoles As FolderPermissionCollection = Security.Permissions.FolderPermissionController.GetFolderPermissionsCollectionByFolder(PortalId, objFile.Folder) - Return CheckRolesMatch(moduleRoles, fileRoles) + Dim fileRoles As FolderPermissionCollection = Security.Permissions.FolderPermissionController.GetFolderPermissionsCollectionByFolder(PortalId, objFile.Folder) + Return CheckRolesMatch(moduleRoles, fileRoles) End If End Select Return True @@ -294,13 +294,13 @@ Namespace DotNetNuke.Modules.Documents Next If blnNotMatching Then ' Warn user that roles do not match - DotNetNuke.UI.Skins.Skin.AddModuleMessage(Me, _ - DotNetNuke.Services.Localization.Localization.GetString("msgFileSecurityWarning.Text", Me.LocalResourceFile).Replace("[$ROLELIST]", IIf(strRolesForMessage.IndexOf(",") >= 0, "s", "").ToString & "'" & strRolesForMessage & "'"), _ + DotNetNuke.UI.Skins.Skin.AddModuleMessage(Me, + DotNetNuke.Services.Localization.Localization.GetString("msgFileSecurityWarning.Text", Me.LocalResourceFile).Replace("[$ROLELIST]", IIf(strRolesForMessage.IndexOf(",") >= 0, "s", "").ToString & "'" & strRolesForMessage & "'"), DotNetNuke.UI.Skins.Controls.ModuleMessage.ModuleMessageType.YellowWarning) Return False Else Return True - End If + End If End Function ''' ----------------------------------------------------------------------------- @@ -314,14 +314,14 @@ Namespace DotNetNuke.Modules.Documents ''' ''' ----------------------------------------------------------------------------- Private Function CheckFileExists(ByVal Url As String) As Boolean - Dim intFileId As Integer + Dim intFileId As Integer Dim objFile As New DotNetNuke.Services.FileSystem.FileInfo Dim blnAddWarning As Boolean If Url = String.Empty Then ' File not selected - DotNetNuke.UI.Skins.Skin.AddModuleMessage(Me, _ - DotNetNuke.Services.Localization.Localization.GetString("msgNoFileSelected.Text", Me.LocalResourceFile), _ + DotNetNuke.UI.Skins.Skin.AddModuleMessage(Me, + DotNetNuke.Services.Localization.Localization.GetString("msgNoFileSelected.Text", Me.LocalResourceFile), DotNetNuke.UI.Skins.Controls.ModuleMessage.ModuleMessageType.YellowWarning) Return False Else @@ -352,8 +352,8 @@ Namespace DotNetNuke.Modules.Documents If blnAddWarning Then ' Display a "file not found" warning - DotNetNuke.UI.Skins.Skin.AddModuleMessage(Me, _ - DotNetNuke.Services.Localization.Localization.GetString("msgFileDeleted.Text", Me.LocalResourceFile), _ + DotNetNuke.UI.Skins.Skin.AddModuleMessage(Me, + DotNetNuke.Services.Localization.Localization.GetString("msgFileDeleted.Text", Me.LocalResourceFile), DotNetNuke.UI.Skins.Controls.ModuleMessage.ModuleMessageType.YellowWarning) Return False End If @@ -457,10 +457,10 @@ Namespace DotNetNuke.Modules.Documents Me.cmdUpdate.Visible = False ' '' Display page-level warning instructing users to click update again if they want to ignore the warning - DotNetNuke.UI.Skins.Skin.AddPageMessage( _ - Me.Page, _ - DotNetNuke.Services.Localization.Localization.GetString("msgFileWarningHeading.Text", Me.LocalResourceFile), _ - DotNetNuke.Services.Localization.Localization.GetString("msgFileWarning.Text", Me.LocalResourceFile), _ + DotNetNuke.UI.Skins.Skin.AddPageMessage( + Me.Page, + DotNetNuke.Services.Localization.Localization.GetString("msgFileWarningHeading.Text", Me.LocalResourceFile), + DotNetNuke.Services.Localization.Localization.GetString("msgFileWarning.Text", Me.LocalResourceFile), Skins.Controls.ModuleMessage.ModuleMessageType.YellowWarning) Exit Sub End If @@ -539,10 +539,10 @@ Namespace DotNetNuke.Modules.Documents Catch exc As Exception 'Module failed to load ProcessModuleLoadException(Me, exc) End Try - End Sub - + End Sub + #End Region - + #Region "Private methods" Private Property ItemID() As Integer Get @@ -566,12 +566,12 @@ Namespace DotNetNuke.Modules.Documents End If Return objDocumentsSettings - End Function + End Function #End Region - + #Region " Web Form Designer Generated Code " - - 'This call is required by the Web Form Designer. + + 'This call is required by the Web Form Designer. Private Sub InitializeComponent() End Sub @@ -580,10 +580,10 @@ Namespace DotNetNuke.Modules.Documents 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeComponent() - End Sub - + End Sub + #End Region - + Private Sub lnkChange_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lnkChange.Click lblOwner.Visible = False lnkChange.Visible = False @@ -615,7 +615,7 @@ Namespace DotNetNuke.Modules.Documents Private Sub PopulateOwnerList() ' populate owner list - lstOwner.DataSource = UserController.GetUsers(Null.NullInteger).Cast(Of UserInfo).Distinct().OrderBy(Function(i As UserInfo) i.DisplayName) + lstOwner.DataSource = UserController.GetUsers(PortalId).Cast(Of UserInfo).Distinct().OrderBy(Function(i As UserInfo) i.DisplayName) lstOwner.DataTextField = "DisplayName" lstOwner.DataValueField = "UserId"