From 5e91faac88c4f55d7f640d7b4d001d5fa0001581 Mon Sep 17 00:00:00 2001 From: Stefan Kamphuis Date: Mon, 24 Jul 2023 12:40:26 +0200 Subject: [PATCH] CKE Adds option to allow browser by permissions --- .../App_LocalResources/Options.aspx.resx | 6 + .../DNNConnect.CKE/CKEditorOptions.ascx | 4 + .../DNNConnect.CKE/CKEditorOptions.ascx.cs | 8 +- .../CKEditorOptions.ascx.designer.cs | 522 +++++++++++++----- .../Constants/SettingConstants.cs | 3 + .../Objects/EditorProviderSettings.cs | 8 +- .../DNNConnect.CKE/Objects/SettingBase.cs | 3 + .../DNNConnect.CKE/Utilities/SettingsUtil.cs | 64 ++- .../DNNConnect.CKE/Utilities/Utility.cs | 38 +- 9 files changed, 516 insertions(+), 140 deletions(-) diff --git a/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/App_LocalResources/Options.aspx.resx b/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/App_LocalResources/Options.aspx.resx index 0a8a9ebfb0a..faca896f4ad 100644 --- a/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/App_LocalResources/Options.aspx.resx +++ b/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/App_LocalResources/Options.aspx.resx @@ -533,4 +533,10 @@ Default Upload Folder for images for all portals (overrides setting below) + + Allow users with folder permissions + + + Allow folder users + \ No newline at end of file diff --git a/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/CKEditorOptions.ascx b/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/CKEditorOptions.ascx index 2634738e8b4..546924d8f70 100644 --- a/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/CKEditorOptions.ascx +++ b/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/CKEditorOptions.ascx @@ -128,6 +128,10 @@ +
+ Allow folder users + +
File Browser Security diff --git a/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/CKEditorOptions.ascx.cs b/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/CKEditorOptions.ascx.cs index 68ace6afc2d..fa65be15817 100644 --- a/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/CKEditorOptions.ascx.cs +++ b/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/CKEditorOptions.ascx.cs @@ -880,6 +880,8 @@ var codeMirrorInfo in this.ConfigUrl.Url = this.ReFormatURL(importedSettings.Config.CustomConfig); } + this.BrowAllowFollowPerms.Checked = importedSettings.BrowserAllowFollowFolderPerms; + if (!string.IsNullOrEmpty(importedSettings.BrowserRoles)) { string sRoles = importedSettings.BrowserRoles; @@ -2435,6 +2437,8 @@ var codeMirrorInfo in moduleController.UpdateModuleSetting(this.ModuleId, $"{key}{SettingConstants.HEIGHT}", this.txtWidth.Text); } + moduleController.UpdateModuleSetting(this.ModuleId, $"{key}{SettingConstants.BROWSERALLOWFOLLOWFOLDERPERMS}", this.BrowAllowFollowPerms.Checked.ToString()); + moduleController.UpdateModuleSetting(this.ModuleId, $"{key}{SettingConstants.BLANKTEXT}", this.txtBlanktext.Text); moduleController.UpdateModuleSetting(this.ModuleId, $"{key}{SettingConstants.CSS}", this.CssUrl.Url); moduleController.UpdateModuleSetting(this.ModuleId, $"{key}{SettingConstants.TEMPLATEFILES}", this.TemplUrl.Url); @@ -2691,7 +2695,7 @@ private void SaveSettingsByKey(string key) EditorController.AddOrUpdateEditorHostSetting($"{key}{SettingConstants.RESIZEHEIGHT}", this.txtResizeHeight.Text); } - EditorController.AddOrUpdateEditorHostSetting($"{key}injectjs", this.InjectSyntaxJs.Checked.ToString()); + EditorController.AddOrUpdateEditorHostSetting($"{key}{SettingConstants.INJECTJS}", this.InjectSyntaxJs.Checked.ToString()); if (Utility.IsUnit(this.txtWidth.Text)) { @@ -2709,6 +2713,8 @@ private void SaveSettingsByKey(string key) EditorController.AddOrUpdateEditorHostSetting($"{key}{SettingConstants.CUSTOMJSFILE}", this.CustomJsFile.Url); EditorController.AddOrUpdateEditorHostSetting($"{key}{SettingConstants.CONFIG}", this.ConfigUrl.Url); + EditorController.AddOrUpdateEditorHostSetting($"{key}{SettingConstants.BROWSERALLOWFOLLOWFOLDERPERMS}", this.BrowAllowFollowPerms.Checked.ToString()); + var sRoles = this.chblBrowsGr.Items.Cast() .Where(item => item.Selected) .Aggregate(string.Empty, (current, item) => current + (item.Value + ";")); diff --git a/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/CKEditorOptions.ascx.designer.cs b/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/CKEditorOptions.ascx.designer.cs index c05ab4d97f2..c04e14d04b2 100644 --- a/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/CKEditorOptions.ascx.designer.cs +++ b/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/CKEditorOptions.ascx.designer.cs @@ -14,882 +14,1152 @@ namespace DNNConnect.CKEditorProvider public partial class CKEditorOptions { - /// lblSettings control. + /// + /// lblSettings control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblSettings; - /// upOptions control. + /// + /// upOptions control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.UpdatePanel upOptions; - /// LastTabId control. + /// + /// LastTabId control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.HiddenField LastTabId; - /// pnlEditor control. + /// + /// pnlEditor control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Panel pnlEditor; - /// lblSetFor control. + /// + /// lblSetFor control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblSetFor; - /// rBlSetMode control. + /// + /// rBlSetMode control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.RadioButtonList rBlSetMode; - /// lblMainSet control. + /// + /// lblMainSet control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblMainSet; - /// lblBrowsSec control. + /// + /// lblBrowsSec control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblBrowsSec; - /// lblCustomToolbars control. + /// + /// lblCustomToolbars control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblCustomToolbars; - /// lblEditorConfig control. + /// + /// lblEditorConfig control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblEditorConfig; - /// InfoTabLi control. + /// + /// InfoTabLi control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl InfoTabLi; - /// lblHeader control. + /// + /// lblHeader control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblHeader; - /// lblBlanktext control. + /// + /// lblBlanktext control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblBlanktext; - /// txtBlanktext control. + /// + /// txtBlanktext control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.TextBox txtBlanktext; - /// lblSkin control. + /// + /// lblSkin control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblSkin; - /// ddlSkin control. + /// + /// ddlSkin control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.DropDownList ddlSkin; - /// lblWidth control. + /// + /// lblWidth control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblWidth; - /// txtWidth control. + /// + /// txtWidth control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.TextBox txtWidth; - /// lblHeight control. + /// + /// lblHeight control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblHeight; - /// txtHeight control. + /// + /// txtHeight control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.TextBox txtHeight; - /// lblToolbars control. + /// + /// lblToolbars control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblToolbars; - /// gvToolbars control. + /// + /// gvToolbars control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.GridView gvToolbars; - /// lblCustomConfig control. + /// + /// lblCustomConfig control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblCustomConfig; - /// ctlConfigUrl control. + /// + /// ctlConfigUrl control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::DNNConnect.CKEditorProvider.Controls.UrlControl ctlConfigUrl; - /// CodeMirrorLabel control. + /// + /// CodeMirrorLabel control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label CodeMirrorLabel; - /// CodeMirrorTheme control. + /// + /// CodeMirrorTheme control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.DropDownList CodeMirrorTheme; - /// lblInjectSyntaxJs control. + /// + /// lblInjectSyntaxJs control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblInjectSyntaxJs; - /// InjectSyntaxJs control. + /// + /// InjectSyntaxJs control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.CheckBox InjectSyntaxJs; - /// lblCssurl control. + /// + /// lblCssurl control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblCssurl; - /// ctlCssurl control. + /// + /// ctlCssurl control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::DNNConnect.CKEditorProvider.Controls.UrlControl ctlCssurl; - /// lblTemplFiles control. + /// + /// lblTemplFiles control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblTemplFiles; - /// ctlTemplUrl control. + /// + /// ctlTemplUrl control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::DNNConnect.CKEditorProvider.Controls.UrlControl ctlTemplUrl; - /// CustomJsFileLabel control. + /// + /// CustomJsFileLabel control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label CustomJsFileLabel; - /// ctlCustomJsFile control. + /// + /// ctlCustomJsFile control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::DNNConnect.CKEditorProvider.Controls.UrlControl ctlCustomJsFile; - /// lblBrowser control. + /// + /// lblBrowser control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblBrowser; - /// ddlBrowser control. + /// + /// ddlBrowser control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.DropDownList ddlBrowser; - /// lblImageButton control. + /// + /// lblImageButton control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblImageButton; - /// ddlImageButton control. + /// + /// ddlImageButton control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.DropDownList ddlImageButton; - /// lblBrowAllow control. + /// + /// lblBrowAllowFollowPerms control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.Label lblBrowAllowFollowPerms; + + /// + /// BrowAllowFollowPerms control. + /// + /// + /// Auto-generated field. + /// To modify move field declaration from designer file to code-behind file. + /// + protected global::System.Web.UI.WebControls.CheckBox BrowAllowFollowPerms; + + /// + /// lblBrowAllow control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblBrowAllow; - /// chblBrowsGr control. + /// + /// chblBrowsGr control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.CheckBoxList chblBrowsGr; - /// HostBrowserRootFolder control. + /// + /// HostBrowserRootFolder control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label HostBrowserRootFolder; - /// HostBrowserRootDir control. + /// + /// HostBrowserRootDir control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.TextBox HostBrowserRootDir; - /// BrowserRootFolder control. + /// + /// BrowserRootFolder control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label BrowserRootFolder; - /// BrowserRootDir control. + /// + /// BrowserRootDir control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.DropDownList BrowserRootDir; - /// HostBrowserRootFolderForImg control. + /// + /// HostBrowserRootFolderForImg control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label HostBrowserRootFolderForImg; - /// HostBrowserRootDirForImg control. + /// + /// HostBrowserRootDirForImg control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.TextBox HostBrowserRootDirForImg; - /// BrowserRootFolderForImg control. + /// + /// BrowserRootFolderForImg control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label BrowserRootFolderForImg; - /// BrowserRootDirForImg control. + /// + /// BrowserRootDirForImg control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.DropDownList BrowserRootDirForImg; - /// lblBrowserDirs control. + /// + /// lblBrowserDirs control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblBrowserDirs; - /// cbBrowserDirs control. + /// + /// cbBrowserDirs control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.CheckBox cbBrowserDirs; - /// HostUploadFolderLabel control. + /// + /// HostUploadFolderLabel control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label HostUploadFolderLabel; - /// HostUploadDir control. + /// + /// HostUploadDir control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.TextBox HostUploadDir; - /// UploadFolderLabel control. + /// + /// UploadFolderLabel control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label UploadFolderLabel; - /// UploadDir control. + /// + /// UploadDir control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.DropDownList UploadDir; - /// HostUploadFolderLabelForImg control. + /// + /// HostUploadFolderLabelForImg control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label HostUploadFolderLabelForImg; - /// HostUploadDirForImg control. + /// + /// HostUploadDirForImg control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.TextBox HostUploadDirForImg; - /// UploadDirForImgOption control. + /// + /// UploadDirForImgOption control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.HtmlControls.HtmlGenericControl UploadDirForImgOption; - /// UploadFolderLabelForImg control. + /// + /// UploadFolderLabelForImg control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label UploadFolderLabelForImg; - /// UploadDirForImg control. + /// + /// UploadDirForImg control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.DropDownList UploadDirForImg; - /// OverrideFileOnUploadLabel control. + /// + /// OverrideFileOnUploadLabel control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label OverrideFileOnUploadLabel; - /// OverrideFileOnUpload control. + /// + /// OverrideFileOnUpload control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.CheckBox OverrideFileOnUpload; - /// UploadFileLimitLabel control. + /// + /// UploadFileLimitLabel control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label UploadFileLimitLabel; - /// UploadFileLimits control. + /// + /// UploadFileLimits control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.GridView UploadFileLimits; - /// lblResizeWidthUpload control. + /// + /// lblResizeWidthUpload control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblResizeWidthUpload; - /// txtResizeWidthUpload control. + /// + /// txtResizeWidthUpload control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.TextBox txtResizeWidthUpload; - /// lblResizeHeightUpload control. + /// + /// lblResizeHeightUpload control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblResizeHeightUpload; - /// txtResizeHeightUpload control. + /// + /// txtResizeHeightUpload control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.TextBox txtResizeHeightUpload; - /// lblResizeWidth control. + /// + /// lblResizeWidth control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblResizeWidth; - /// txtResizeWidth control. + /// + /// txtResizeWidth control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.TextBox txtResizeWidth; - /// lblResizeHeight control. + /// + /// lblResizeHeight control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblResizeHeight; - /// txtResizeHeight control. + /// + /// txtResizeHeight control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.TextBox txtResizeHeight; - /// lblUseAnchorSelector control. + /// + /// lblUseAnchorSelector control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblUseAnchorSelector; - /// UseAnchorSelector control. + /// + /// UseAnchorSelector control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.CheckBox UseAnchorSelector; - /// lblShowPageLinksTabFirst control. + /// + /// lblShowPageLinksTabFirst control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblShowPageLinksTabFirst; - /// ShowPageLinksTabFirst control. + /// + /// ShowPageLinksTabFirst control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.CheckBox ShowPageLinksTabFirst; - /// FileListViewModeLabel control. + /// + /// FileListViewModeLabel control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label FileListViewModeLabel; - /// FileListViewMode control. + /// + /// FileListViewMode control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.DropDownList FileListViewMode; - /// FileListPageSizeLabel control. + /// + /// FileListPageSizeLabel control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label FileListPageSizeLabel; - /// FileListPageSize control. + /// + /// FileListPageSize control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.TextBox FileListPageSize; - /// DefaultLinkModeLabel control. + /// + /// DefaultLinkModeLabel control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label DefaultLinkModeLabel; - /// DefaultLinkMode control. + /// + /// DefaultLinkMode control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.DropDownList DefaultLinkMode; - /// lblToolbarList control. + /// + /// lblToolbarList control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblToolbarList; - /// dDlCustomToolbars control. + /// + /// dDlCustomToolbars control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.DropDownList dDlCustomToolbars; - /// iBEdit control. + /// + /// iBEdit control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.ImageButton iBEdit; - /// iBDelete control. + /// + /// iBDelete control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.ImageButton iBDelete; - /// lblToolbName control. + /// + /// lblToolbName control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblToolbName; - /// dnnTxtToolBName control. + /// + /// dnnTxtToolBName control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.TextBox dnnTxtToolBName; - /// iBAdd control. + /// + /// iBAdd control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.ImageButton iBAdd; - /// iBCancel control. + /// + /// iBCancel control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.ImageButton iBCancel; - /// lblToolbSet control. + /// + /// lblToolbSet control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblToolbSet; - /// AvailableToolbarButtons control. + /// + /// AvailableToolbarButtons control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Repeater AvailableToolbarButtons; - /// ToolbarGroupsLabel control. + /// + /// ToolbarGroupsLabel control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label ToolbarGroupsLabel; - /// ToolbarSet control. + /// + /// ToolbarSet control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.HiddenField ToolbarSet; - /// ToolbarGroupsRepeater control. + /// + /// ToolbarGroupsRepeater control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Repeater ToolbarGroupsRepeater; - /// CreateGroupLabel control. + /// + /// CreateGroupLabel control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label CreateGroupLabel; - /// AddRowBreakLabel control. + /// + /// AddRowBreakLabel control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label AddRowBreakLabel; - /// lblToolbarPriority control. + /// + /// lblToolbarPriority control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblToolbarPriority; - /// dDlToolbarPrio control. + /// + /// dDlToolbarPrio control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.DropDownList dDlToolbarPrio; - /// EditorConfigWarning control. + /// + /// EditorConfigWarning control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label EditorConfigWarning; - /// EditorConfigHolder control. + /// + /// EditorConfigHolder control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Panel EditorConfigHolder; - /// InfoTabHolder control. + /// + /// InfoTabHolder control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.PlaceHolder InfoTabHolder; - /// ProviderVersion control. + /// + /// ProviderVersion control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label ProviderVersion; - /// lblPortal control. + /// + /// lblPortal control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblPortal; - /// lblPage control. + /// + /// lblPage control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblPage; - /// lblModType control. + /// + /// lblModType control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblModType; - /// lblModName control. + /// + /// lblModName control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblModName; - /// lblModInst control. + /// + /// lblModInst control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblModInst; - /// lblUName control. + /// + /// lblUName control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblUName; - /// btnOk control. + /// + /// btnOk control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Button btnOk; - /// CopyToAllChild control. + /// + /// CopyToAllChild control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.LinkButton CopyToAllChild; - /// lnkRemoveAll control. + /// + /// lnkRemoveAll control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.LinkButton lnkRemoveAll; - /// lnkRemoveChild control. + /// + /// lnkRemoveChild control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.LinkButton lnkRemoveChild; - /// lnkRemove control. + /// + /// lnkRemove control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.LinkButton lnkRemove; - /// lblImport control. + /// + /// lblImport control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblImport; - /// lblExport control. + /// + /// lblExport control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label lblExport; - /// ExportDialogUpdatePanel control. + /// + /// ExportDialogUpdatePanel control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.UpdatePanel ExportDialogUpdatePanel; - /// ExportDir control. + /// + /// ExportDir control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.DropDownList ExportDir; - /// ExportFileName control. + /// + /// ExportFileName control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.TextBox ExportFileName; - /// ExportNow control. + /// + /// ExportNow control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.LinkButton ExportNow; - /// HiddenMessage control. + /// + /// HiddenMessage control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.HiddenField HiddenMessage; - /// upNewUpdatePanel control. + /// + /// upNewUpdatePanel control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.UpdatePanel upNewUpdatePanel; - /// ctlImportFile control. + /// + /// ctlImportFile control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::DNNConnect.CKEditorProvider.Controls.UrlControl ctlImportFile; - /// lnkImportNow control. + /// + /// lnkImportNow control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.LinkButton lnkImportNow; - /// panelLoading control. + /// + /// panelLoading control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Panel panelLoading; - /// Wait control. + /// + /// Wait control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. /// protected global::System.Web.UI.WebControls.Label Wait; - /// WaitMessage control. + /// + /// WaitMessage control. + /// /// /// Auto-generated field. /// To modify move field declaration from designer file to code-behind file. diff --git a/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/Constants/SettingConstants.cs b/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/Constants/SettingConstants.cs index 828fa260bfe..2ab0be68d79 100644 --- a/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/Constants/SettingConstants.cs +++ b/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/Constants/SettingConstants.cs @@ -68,6 +68,9 @@ public static class SettingConstants /// The inject JS setting name. public const string INJECTJS = "injectjs"; + + /// The browser allow follow folder permissions setting name. + public const string BROWSERALLOWFOLLOWFOLDERPERMS = "BrowsAllowFolderPerms"; /// The roles setting name. public const string ROLES = "roles"; diff --git a/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/Objects/EditorProviderSettings.cs b/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/Objects/EditorProviderSettings.cs index 1c3c79e5727..3ec56b1e1da 100644 --- a/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/Objects/EditorProviderSettings.cs +++ b/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/Objects/EditorProviderSettings.cs @@ -30,6 +30,7 @@ public EditorProviderSettings() this.ResizeWidthUpload = -1; this.ResizeHeightUpload = -1; this.ResizeWidth = -1; + this.BrowserAllowFollowFolderPerms = false; this.BrowserRoles = "0;Administrators;"; this.Browser = "standard"; this.ImageButton = "standard"; @@ -166,7 +167,12 @@ public EditorProviderSettings() public ImageButtonType ImageButtonMode { get; set; } /// Gets or sets a value indicating whether which Image Button to use. - public string ImageButton { get; set; } + public string ImageButton { get; set; } + + /// + /// Gets or sets a value indicating whether allowing the file browser will depend on folder permissions. + /// + public bool BrowserAllowFollowFolderPerms { get; set; } /// Gets or sets a value indicating whether Allowed Browser Roles. public string BrowserRoles { get; set; } diff --git a/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/Objects/SettingBase.cs b/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/Objects/SettingBase.cs index 319633a0101..3dfcfad0179 100644 --- a/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/Objects/SettingBase.cs +++ b/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/Objects/SettingBase.cs @@ -92,6 +92,9 @@ public class SettingBase : object /// Gets or sets a value indicating whether Editor File Browser. public string sBrowser { get; set; } + /// Gets or sets a value indicating whether Browser Allow follows Folder Permissions. + public bool BrowserAllowFollowFolderPerms { get; set; } + /// Gets or sets a value indicating whether Allowed Browser Roles. public string sBrowserRoles { get; set; } diff --git a/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/Utilities/SettingsUtil.cs b/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/Utilities/SettingsUtil.cs index 8423b3fdacf..c88a799c3de 100644 --- a/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/Utilities/SettingsUtil.cs +++ b/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/Utilities/SettingsUtil.cs @@ -384,6 +384,23 @@ internal static EditorProviderSettings LoadEditorSettingsByKey( currentSettings.UploadSizeRoles = listUploadSizeRoles; + if ( + filteredSettings.Any( + setting => setting.Name.Equals($"{key}{SettingConstants.BROWSERALLOWFOLLOWFOLDERPERMS}"))) + { + var settingValue = + filteredSettings.FirstOrDefault( + s => s.Name.Equals($"{key}{SettingConstants.BROWSERALLOWFOLLOWFOLDERPERMS}")).Value; + + if (!string.IsNullOrEmpty(settingValue)) + { + if (bool.TryParse(settingValue, out var bResult)) + { + currentSettings.BrowserAllowFollowFolderPerms = bResult; + } + } + } + if ( filteredSettings.Any( setting => setting.Name.Equals(string.Format("{0}{1}", key, SettingConstants.ROLES)))) @@ -452,6 +469,18 @@ internal static EditorProviderSettings LoadEditorSettingsByKey( break; case "standard": + if (currentSettings.BrowserAllowFollowFolderPerms) + { + if (Utility.CheckIfUserHasFolderReadAccess(currentSettings.BrowserRootDirId, portalSettings)) + { + currentSettings.BrowserMode = BrowserType.StandardBrowser; + break; + } + + currentSettings.BrowserMode = BrowserType.None; + } + + // If the user doesn't get the browser through folder permissions, check the browser-allowed roles foreach (string sRoleName in roles) { if (PortalSecurity.IsInRoles(sRoleName)) @@ -1172,6 +1201,15 @@ PropertyInfo info in currentSettings.UploadSizeRoles = listUploadSizeRoles; + if (!string.IsNullOrEmpty((string)hshModSet[$"{key}{SettingConstants.BROWSERALLOWFOLLOWFOLDERPERMS}"])) + { + bool bResult; + if (bool.TryParse((string)hshModSet[$"{key}{SettingConstants.BROWSERALLOWFOLLOWFOLDERPERMS}"], out bResult)) + { + currentSettings.BrowserAllowFollowFolderPerms = bResult; + } + } + if (!string.IsNullOrEmpty((string)hshModSet[string.Format("{0}{1}", key, SettingConstants.ROLES)])) { string sRoles = (string)hshModSet[string.Format("{0}{1}", key, SettingConstants.ROLES)]; @@ -1219,6 +1257,18 @@ PropertyInfo info in break; case "standard": + if (currentSettings.BrowserAllowFollowFolderPerms) + { + if (Utility.CheckIfUserHasFolderReadAccess(currentSettings.BrowserRootDirId, portalSettings)) + { + currentSettings.BrowserMode = BrowserType.StandardBrowser; + break; + } + + currentSettings.BrowserMode = BrowserType.None; + } + + // If the user doesn't get the browser through folder permissions, check the browser-allowed roles foreach (string sRoleName in roles) { if (PortalSecurity.IsInRoles(sRoleName)) @@ -1566,12 +1616,23 @@ internal static EditorProviderSettings GetDefaultSettings(IPortalSettings portal break; case "standard": + if (settings.BrowserAllowFollowFolderPerms) + { + if (Utility.CheckIfUserHasFolderReadAccess(settings.BrowserRootDirId, portalSettings)) + { + settings.BrowserMode = BrowserType.StandardBrowser; + break; + } + + settings.BrowserMode = BrowserType.None; + } + + // If the user doesn't get the browser through folder permissions, check the browser-allowed roles foreach (string sRoleName in roles) { if (PortalSecurity.IsInRoles(sRoleName)) { settings.BrowserMode = BrowserType.StandardBrowser; - break; } @@ -1702,6 +1763,7 @@ internal static void ImportSettingBaseXml(string homeDirPath, bool isDefaultXmlF ResizeWidth = oldDefaultSettings.iResizeWidth, ToolBarRoles = oldDefaultSettings.listToolbRoles, BlankText = oldDefaultSettings.sBlankText, + BrowserAllowFollowFolderPerms = oldDefaultSettings.BrowserAllowFollowFolderPerms, BrowserRoles = oldDefaultSettings.sBrowserRoles, Browser = oldDefaultSettings.sBrowser, Config = diff --git a/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/Utilities/Utility.cs b/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/Utilities/Utility.cs index 5676ec34723..6385005dc93 100644 --- a/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/Utilities/Utility.cs +++ b/DNN Platform/Providers/HtmlEditorProviders/DNNConnect.CKE/Utilities/Utility.cs @@ -242,18 +242,18 @@ public static string ConvertUnicodeChars(string input) /// public static bool CheckIfUserHasFolderWriteAccess(int folderId, IPortalSettings portalSettings) { - try - { - var checkFolder = folderId.Equals(-1) - ? ConvertFilePathToFolderInfo(portalSettings.HomeDirectoryMapPath, portalSettings) - : FolderManager.Instance.GetFolder(folderId); + return CheckIfUserHasFolderAccess(folderId, portalSettings, "WRITE"); + } - return FolderPermissionController.HasFolderPermission(checkFolder.FolderPermissions, "WRITE"); - } - catch (Exception) - { - return false; - } + /// Checks if user has read access to the folder. + /// The folder id. + /// The portal settings. + /// + /// Returns if the user has write access to the folder. + /// + public static bool CheckIfUserHasFolderReadAccess(int folderId, IPortalSettings portalSettings) + { + return CheckIfUserHasFolderAccess(folderId, portalSettings, "READ"); } /// Converts a File Path to a Folder Info. @@ -504,5 +504,21 @@ public static IFolderInfo EnsureGetFolder(int portalId, string folderPath) return null; } + + private static bool CheckIfUserHasFolderAccess(int folderId, IPortalSettings portalSettings, string permissionKey) + { + try + { + var checkFolder = folderId.Equals(-1) + ? ConvertFilePathToFolderInfo(portalSettings.HomeDirectoryMapPath, portalSettings) + : FolderManager.Instance.GetFolder(folderId); + + return FolderPermissionController.HasFolderPermission(checkFolder.FolderPermissions, permissionKey); + } + catch (Exception) + { + return false; + } + } } }