/// <summary> /// Get the AllowedModules array from page if exists and set the restrictions for use /// For this method work, the user page need override AllowedModules with GUIDS /// </summary> protected override void ModuleGuidInCookie() { if (AllowedModules != null) { string guidsInUse = string.Empty; if (base.Request.Cookies["RainbowSecurity"] != null) { guidsInUse = Request.Cookies["RainbowSecurity"].Value; } foreach (string mg in AllowedModules) { if (guidsInUse.IndexOf(mg.ToUpper()) > -1) { return; } } if (ModuleID != 0) { guidsInUse = (new ModulesDB()).GetModuleGuid(ModuleID).ToString().ToUpper(); ; foreach (string mg in AllowedModules) { if (guidsInUse.IndexOf(mg.ToUpper()) > -1) { return; } } } PortalSecurity.AccessDenied(); } }
/// <summary> /// Get the AllowedModules array from page if exists and set the restrictions for use /// For this method work, the user page need override AllowedModules with GUIDS /// </summary> protected override void ModuleGuidInCookie() { if (this.AllowedModules == null) { return; } var guidsInUse = string.Empty; var cookie = this.Request.Cookies["AppleseedSecurity"]; if (cookie != null) { guidsInUse = cookie.Value; } if (this.AllowedModules.Any(mg => guidsInUse.IndexOf(mg.ToUpper()) > -1)) { return; } if (this.ModuleID != 0) { guidsInUse = (new ModulesDB()).GetModuleGuid(this.ModuleID).ToString().ToUpper(); if (this.AllowedModules.Any(mg => guidsInUse.IndexOf(mg.ToUpper()) > -1)) { return; } } PortalSecurity.AccessDenied(); }
/// <summary> /// Load settings /// </summary> protected override void LoadSettings() { // Verify that the current user has access to view this module if (PortalSecurity.HasViewPermissions(ModuleID) == false) { // Removed by Mario Endara <*****@*****.**> (2004/11/04) // && PortalSecurity.IsInRoles("Admins") == false) PortalSecurity.AccessDenied(); } base.LoadSettings(); }
/// <summary> /// Handles the Load event of the DesktopDefault control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> private void DesktopDefault_Load(object sender, EventArgs e) { // Ensure that the visiting user has access to the current page if (PortalSecurity.IsInRoles(portalSettings.ActivePage.AuthorizedRoles) == false) { PortalSecurity.AccessDenied(); } else { LoadPage(); } }
protected void Page_Load(object sender, EventArgs e) { if (!UserProfile.HasEditThisPageAccess() && !UserProfile.HasAdminPageAccess()) { PortalSecurity.AccessDenied(); return; } if (!IsPostBack) { loadData(); } }
/// <summary> /// Raises the <see cref="E:System.Web.UI.Control.Load"/> event. /// </summary> /// <param name="e">The <see cref="T:System.EventArgs"/> object that contains the event data.</param> protected override void OnLoad(EventArgs e) { if (!UserProfile.HasPortalAdministrationAccess() && !UserProfile.HasModuleAddEditAccess()) { PortalSecurity.AccessDenied(); return; } base.OnLoad(e); if (!this.Page.IsPostBack) { this.BindData(); } }
public override void OnActionExecuting(ActionExecutingContext filterContext) { // This method is executed before calling the action // and here you have access to the route data: var mID = (int)filterContext.ActionParameters["mID"]; if (!PortalSecurity.HasEditPermissions(mID)) { PortalSecurity.AccessDenied(); filterContext.Result = new EmptyResult(); } else { base.OnActionExecuting(filterContext); } }
public ActionResult Module() { SetModuleId(); if (PortalSecurity.HasViewPermissions(ModuleId)) { var model = new FileManagerModel { PortalName = PortalSettings.PortalFullPath, ModuleId = ModuleId, ViewPermission = PortalSecurity.HasViewPermissions(ModuleId), EditPermission = PortalSecurity.HasEditPermissions(ModuleId) }; return(View(model)); } PortalSecurity.AccessDenied(); return(new EmptyResult()); }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> private void Page_Load(object sender, EventArgs e) { string _user = string.Empty; string _password = string.Empty; string _alias = string.Empty; // Get Login User from querystring if (Request.Params["usr"] != null) { _user = Request.Params["usr"]; // Get Login Password from querystring if (Request.Params["pwd"] != null) { _password = Request.Params["pwd"]; } // Get portalaias if (Request.Params["alias"] != null) { _alias = HttpUrlBuilder.BuildUrl("~/Default.aspx", 0, string.Empty, Request.Params["alias"]); } //try to validate logon if (PortalSecurity.SignOn(_user, _password, false, _alias) == null) { // Login failed PortalSecurity.AccessDenied(); } } else { //if user has logged on if (Request.IsAuthenticated) { // Redirect user back to the Portal Home Page PortalSecurity.PortalHome(); } else { //User not provided, display logon signIn.Controls.Add(LoadControl("~/DesktopModules/CoreModules/SignIn/Signin.ascx")); } } }
/// <summary> /// The BindData helper method is used to populate a asp:datalist /// server control with the current "edit access" permissions /// set within the portal configuration system /// </summary> private void BindData() { var useNTLM = HttpContext.Current.User is WindowsPrincipal; // add by Jonathan Fong 22/07/2004 to support LDAP // jes1111 - useNTLM |= ConfigurationSettings.AppSettings["LDAPLogin"] != null ? true : false; useNTLM |= Config.LDAPLogin.Length != 0 ? true : false; this.authAddRoles.Visible = this.authApproveRoles.Visible = this.authDeleteRoles.Visible = this.authEditRoles.Visible = this.authPropertiesRoles.Visible = this.authPublishingRoles.Visible = this.authMoveModuleRoles.Visible = this.authDeleteModuleRoles.Visible = this.authViewRoles.Visible = !useNTLM; var m = this.GetModule(); if (m != null) { this.moduleType.Text = GiveMeFriendlyName(m.GuidID); // Update Textbox Settings this.moduleTitle.Text = m.ModuleTitle; this.cacheTime.Text = m.CacheTime.ToString(); this.portalTabs = new PagesDB().GetPagesFlat(this.PortalSettings.PortalID); this.tabDropDownList.DataBind(); this.tabDropDownList.ClearSelection(); if (this.tabDropDownList.Items.FindByValue(m.PageID.ToString()) != null) { this.tabDropDownList.Items.FindByValue(m.PageID.ToString()).Selected = true; } // Change by [email protected] // Date: 19/5/2003 this.showEveryWhere.Checked = m.ShowEveryWhere; // is the window mgmt support enabled // jes1111 - allowCollapsable.Enabled = GlobalResources.SupportWindowMgmt; this.allowCollapsable.Enabled = Config.WindowMgmtControls; this.allowCollapsable.Checked = m.SupportCollapsable; this.ShowMobile.Checked = m.ShowMobile; // Change by [email protected] // Date: 6/2/2003 PortalModuleControl pm = null; var controlPath = Path.WebPathCombine(Path.ApplicationRoot, m.DesktopSrc); try { if (!controlPath.Contains("Area")) { pm = (PortalModuleControl)this.LoadControl(controlPath); if (pm.InnerSupportsWorkflow) { this.enableWorkflowSupport.Checked = m.SupportWorkflow; this.authApproveRoles.Enabled = m.SupportWorkflow; this.authPublishingRoles.Enabled = m.SupportWorkflow; this.PopulateRoles(ref this.authPublishingRoles, m.AuthorizedPublishingRoles); this.PopulateRoles(ref this.authApproveRoles, m.AuthorizedApproveRoles); } else { this.enableWorkflowSupport.Enabled = false; this.authApproveRoles.Enabled = false; this.authPublishingRoles.Enabled = false; } } } catch (Exception ex) { // ErrorHandler.HandleException("There was a problem loading: '" + controlPath + "'", ex); // throw; throw new AppleseedException( LogLevel.Error, "There was a problem loading: '" + controlPath + "'", ex); } // End Change [email protected] // Populate checkbox list with all security roles for this portal // and "check" the ones already configured for this module this.PopulateRoles(ref this.authEditRoles, m.AuthorizedEditRoles); this.PopulateRoles(ref this.authViewRoles, m.AuthorizedViewRoles); this.PopulateRoles(ref this.authAddRoles, m.AuthorizedAddRoles); this.PopulateRoles(ref this.authDeleteRoles, m.AuthorizedDeleteRoles); this.PopulateRoles(ref this.authMoveModuleRoles, m.AuthorizedMoveModuleRoles); this.PopulateRoles(ref this.authDeleteModuleRoles, m.AuthorizedDeleteModuleRoles); this.PopulateRoles(ref this.authPropertiesRoles, m.AuthorizedPropertiesRoles); // Jes1111 if (pm != null) { if (!pm.Cacheable) { this.cacheTime.Text = "-1"; this.cacheTime.Enabled = false; } } } else { // Denied access if Module not in Tab. [email protected] (2004/07/23) PortalSecurity.AccessDenied(); } }
/// <summary> /// Handles the Load event of the DesktopDefault control. /// </summary> /// <param name="sender"> /// The source of the event. /// </param> /// <param name="e"> /// The <see cref="System.EventArgs"/> instance containing the event data. /// </param> private void DesktopDefault_Load(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Request.Params["panelist"])) { this.RenderContentAreaList(); } // intento obtener el id de la pagina desde el query string query = Request.Url.Query; int pageId = 0; if (query.Contains("?") && query.ToLower().Contains("pageid")) { int index = query.IndexOf('?'); int indexPageId = query.ToLower().IndexOf("pageid") + 5; if (index < indexPageId - 5) { query = query.Substring(indexPageId + 2, query.Length - indexPageId - 2); index = query.IndexOf('&'); if (index > 0) // no va hasta el final el numero de pagina { query = query.Substring(0, index); } try { pageId = int.Parse(query); } catch (Exception) { pageId = 0; } } else { pageId = 0; } } else { pageId = this.PortalSettings.ActivePage.PageID; } if (pageId == 0) { pageId = Convert.ToInt32(SiteMap.RootNode.ChildNodes[0].Key); this.Response.Redirect(HttpUrlBuilder.BuildUrl(pageId)); } string urlToRedirect = ""; bool redirect = HttpUrlBuilder.ValidateProperUrl(pageId, ref urlToRedirect); if (!redirect) { this.Response.Redirect(urlToRedirect); } if (!PortalSecurity.IsInRoles(this.PortalSettings.ActivePage.AuthorizedRoles) && !this.User.IsInRole("Admins")) { PortalSecurity.AccessDenied(); } else { if (this.Request.Params["r"] == null || this.Request.Params["r"] != "0") { var user = Membership.GetUser(); } var userName = this.Request.Params["u"]; var pass = this.Request.Params["p"]; if (!string.IsNullOrEmpty(userName) && !string.IsNullOrEmpty(pass)) { // PortalSecurity.SignOn(userName, pass, false, "~/DesktopDefault.aspx"); var rem = (this.Request.Params["rem"] ?? "0").Equals("1") ? true : false; PortalSecurity.SignOn(userName, pass, rem, "~/DesktopDefault.aspx"); this.Response.Redirect("~/DesktopDefault.aspx"); } if (string.IsNullOrEmpty(Request.Params["panelist"])) { this.LoadPage(); } } }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender"> /// The source of the event. /// </param> /// <param name="e"> /// The <see cref="T:System.EventArgs"/> instance containing the event data. /// </param> private void Page_Load(object sender, EventArgs e) { var _user = string.Empty; var _password = string.Empty; var _alias = string.Empty; var _pageId = 0; // Get Login User from querystring if (this.Request.Params["usr"] != null) { _user = this.Request.Params["usr"]; // Get Login Password from querystring if (this.Request.Params["pwd"] != null) { _password = this.Request.Params["pwd"]; } // Get portalaias if (this.Request.Params["alias"] != null) { _alias = HttpUrlBuilder.BuildUrl("~/" + HttpUrlBuilder.DefaultPage, 0, string.Empty, this.Request.Params["alias"]); } if (this.Request.Params["pageId"] != null) { try { _pageId = int.Parse(this.Request.Params["pageId"]); _alias = HttpUrlBuilder.BuildUrl(_pageId); } catch { PortalSecurity.AccessDenied(); } } // try to validate logon if (PortalSecurity.SignOn(_user, _password, true, _alias) == null) { // Login failed PortalSecurity.AccessDenied(); } } else { // if user has logged on if (this.Request.IsAuthenticated) { // Redirect user back to the Portal Home Page PortalSecurity.PortalHome(); } else { // User not provided, display logon var controlStr = "~/DesktopModules/CoreModules/SignIn/Signin.ascx"; if (this.PortalSettings.CustomSettings.ContainsKey("SITESETTINGS_LOGIN_TYPE")) { controlStr = Convert.ToString(this.PortalSettings.CustomSettings["SITESETTINGS_LOGIN_TYPE"]); } try { this.signIn.Controls.Add(this.LoadControl(controlStr)); } catch (Exception exc) { ErrorHandler.Publish(LogLevel.Error, exc); this.signIn.Controls.Add(this.LoadControl("~/DesktopModules/CoreModules/SignIn/Signin.ascx")); } } } }
protected void Page_Load(object sender, EventArgs e) { //plcEditFile.Visible = EditFile; if (!UserProfile.HasEditThisPageAccess() && !UserProfile.HasAdminPageAccess()) { PortalSecurity.AccessDenied(); return; } ImageFolder = (!String.IsNullOrEmpty(HF_FileBrowserConfig.Attributes["data-imagefolder"]) ? HF_FileBrowserConfig.Attributes["data-imagefolder"] : "images"); FlashFolder = (!String.IsNullOrEmpty(HF_FileBrowserConfig.Attributes["data-flashfolder"]) ? HF_FileBrowserConfig.Attributes["data-flashfolder"] : "flash"); MediaFolder = (!String.IsNullOrEmpty(HF_FileBrowserConfig.Attributes["data-mediafolder"]) ? HF_FileBrowserConfig.Attributes["data-mediafolder"] : "media"); FilesFolder = (!String.IsNullOrEmpty(HF_FileBrowserConfig.Attributes["data-filesfolder"]) ? HF_FileBrowserConfig.Attributes["data-filesfolder"] : "files"); string useCustomStr = String.IsNullOrEmpty(HF_CustomRoots.Attributes[USE_CUSTOMROOTS]) ? "" : HF_CustomRoots.Attributes[USE_CUSTOMROOTS]; string useDefaultStr = String.IsNullOrEmpty(HF_CustomRoots.Attributes[USE_DEFAULTROOTS]) ? "" : HF_CustomRoots.Attributes[USE_DEFAULTROOTS]; string hideCommandsStr = String.IsNullOrEmpty(HF_FileBrowserConfig.Attributes[READONLY_HIDECOMMANDS]) ? "" : HF_FileBrowserConfig.Attributes[READONLY_HIDECOMMANDS]; UseCustomRoots = useCustomStr.ToLower() != "false"; UseDefaultRoots = useDefaultStr.ToLower() == "true"; HideCommands = hideCommandsStr != "false"; UseDefaultRoots = false; //if (Request.Url.Host.IndexOf("localhost") > -1) // FileManager1.DefaultAccessMode = AccessMode.Write; CultureInfo culture = new CultureInfo("en-US"); FileManager1.Culture = new CultureInfo("en-US"); //FileManager1.ShowAddressBar = false; //FileManager1.AllowUpload = false; String cbReference = Page.ClientScript.GetCallbackEventReference(this, "arg", "ReceiveServerData", "context"); String callbackScript; callbackScript = "function CallServer(arg, context)" + "{ " + cbReference + ";}"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "CallServer", callbackScript, true); if (!IsPostBack) { HF_EditableFiles.Value = System.Configuration.ConfigurationManager.AppSettings["FileManager.Edit.SupportExtenstion"]; /** * -------- Parameters -------------- * CKEDITOR automatically call FileManager service adding two custom parameters * CKEditorFuncNum e type. * First parameter allows you to pass choosen file url back to CKEDITOR * through callback function * Type paramete is used to restrict the file search to a * specific folder * * Tiny MCE 4 use the type parameter and field parameter wich is * the id of the field whose value must be set. * * * Other recognized parameters * caller: * allowed values: ckeditor, tinymce, parent, top * default: caller id defaulted to ckeditor if the CKEditor parameter is specified otherwise to parent * Idicates the object to wich the callback must be return * * fn: * allowed values: any string * default: null * Function name to be called. * * langCode: * allowed value: a standard language code * default: current language * CKEdito pass this paramenter automatically * */ int fnumber = 0; string caller, fn; // the caller is CKEditor if (!string.IsNullOrEmpty(Request["CKEditor"])) { caller = "ckeditor"; } else { caller = (String.IsNullOrEmpty(Request["caller"]) ? "parent" : Request["caller"]); } HF_Opener.Value = caller; fn = Request["fn"]; if (!String.IsNullOrEmpty(fn)) { HF_CallBack.Value = fn; } if (int.TryParse(Request["CKEditorFuncNum"], out fnumber)) { HF_CKEditorFunctionNumber.Value = fnumber.ToString(); } if (!String.IsNullOrEmpty(Request["field"])) { HF_Field.Value = Request["field"]; } string type = ""; string mainRoot = "~/userfiles"; if (FileManager1.Culture == null) { FileManager1.Culture = culture; } HF_CurrentCulture.Value = FileManager1.Culture.Name; FileManager1.CustomToolbarButtons[0].Text = FileManager1.Controller.GetResourceString("View_file", "View File"); Upload_button.InnerText = FileManager1.Controller.GetResourceString("Upload_file_click", "Click here to upload a file"); DND_message.InnerText = FileManager1.Controller.GetResourceString("Upload_dnd", "Or drag 'nd drop one or more files on the above area"); if (!String.IsNullOrEmpty(FileManager1.MainDirectory)) { mainRoot = FileManager1.MainDirectory; } //mainRoot = ResolveClientUrl(mainRoot); if (!Directory.Exists(Server.MapPath(ResolveClientUrl(mainRoot)))) { throw new Exception("User directory with write privileges is needed."); } DirectoryInfo mainRootInfo = new DirectoryInfo(Server.MapPath(ResolveClientUrl(mainRoot))); if (!String.IsNullOrEmpty(Request["type"])) { type = Request["type"]; } RootDirectory images, flash, files, media; // Display text of root folders are localized using WebFileBrowser resources files // in "/App_GlobalResources/WebFileManager" and GetResoueceString method // of FileManager.Controller class MB.FileBrowser.MagicSession.Current.FileBrowserAccessMode = AccessMode.Delete; //FileManager1.RootDirectories.Clear(); //FileManager1.RootDirectories.Add(new RootDirectory(){ }) var root = FileManager1.RootDirectories[0].DirectoryPath; string allowedFolder = System.Configuration.ConfigurationManager.AppSettings["FileManager.AllowFolders.Tree"]; if (!string.IsNullOrEmpty(allowedFolder)) { string[] folders = allowedFolder.Split('|'); FileManager1.RootDirectories.Clear(); int i = 0; foreach (var fldr in folders) { RootDirectory rp = new RootDirectory(); rp.ShowRootIndex = false; //rp.DirectoryPath = Server.MapPath(ResolveClientUrl(root + fldr)); rp.DirectoryPath = VirtualPathUtility.AppendTrailingSlash(mainRoot) + fldr;; // rp.Text = FileManager1.Controller.GetResourceString("Root_Image", fldr); rp.Text = fldr; rp.ExpandDepth = i == 0 ? 1 : 0; rp.LargeImageUrl = "~/DesktopModules/CoreModules/FileBrowser/img/32/folder-document-alt.png"; rp.SmallImageUrl = "~/DesktopModules/CoreModules/FileBrowser/img/16/folder-document-alt.png"; FileManager1.RootDirectories.Add(rp); i++; } } else { if (UseDefaultRoots) { mainRootInfo.CreateSubdirectory(ImageFolder); mainRootInfo.CreateSubdirectory(FilesFolder); mainRootInfo.CreateSubdirectory(FlashFolder); mainRootInfo.CreateSubdirectory(MediaFolder); switch (type) { case "images": case "image": FileManager1.RootDirectories.Clear(); images = new RootDirectory(); images.ShowRootIndex = false; images.DirectoryPath = VirtualPathUtility.AppendTrailingSlash(mainRoot) + ImageFolder; images.Text = FileManager1.Controller.GetResourceString("Root_Image", "Images"); images.LargeImageUrl = "~/DesktopModules/CoreModules/FileBrowser/img/32/camera.png"; images.SmallImageUrl = "~/DesktopModules/CoreModules/FileBrowser/img/16/camera.png"; FileManager1.RootDirectories.Add(images); break; case "flash": FileManager1.RootDirectories.Clear(); flash = new RootDirectory(); flash.ShowRootIndex = false; flash.DirectoryPath = VirtualPathUtility.AppendTrailingSlash(mainRoot) + FlashFolder; flash.LargeImageUrl = "~/DesktopModules/CoreModules/FileBrowser/img/32/folder-flash.png"; flash.SmallImageUrl = "~/DesktopModules/CoreModules/FileBrowser/img/16/folder-flash.png"; flash.Text = FileManager1.Controller.GetResourceString("Root_Flash", "Flash Movies"); FileManager1.RootDirectories.Add(flash); break; case "files": FileManager1.RootDirectories.Clear(); files = new RootDirectory(); files.ShowRootIndex = false; files.DirectoryPath = VirtualPathUtility.AppendTrailingSlash(mainRoot) + FilesFolder; files.LargeImageUrl = "~/DesktopModules/CoreModules/FileBrowser/img/32/folder-document-alt.png"; files.SmallImageUrl = "~/DesktopModules/CoreModules/FileBrowser/img/16/folder-document-alt.png"; files.Text = FileManager1.Controller.GetResourceString("Root_File", "Files"); FileManager1.RootDirectories.Add(files); break; case "media": FileManager1.RootDirectories.Clear(); media = new RootDirectory(); media.ShowRootIndex = false; media.DirectoryPath = VirtualPathUtility.AppendTrailingSlash(mainRoot) + MediaFolder; media.LargeImageUrl = "~/DesktopModules/CoreModules/FileBrowser/img/32/folder-video-alt.png"; media.SmallImageUrl = "~/DesktopModules/CoreModules/FileBrowser/img/16/folder-video-alt.png"; media.Text = FileManager1.Controller.GetResourceString("Root_Media", "Media"); FileManager1.RootDirectories.Add(media); break; default: FileManager1.RootDirectories.Clear(); files = new RootDirectory(); files.ShowRootIndex = false; files.DirectoryPath = VirtualPathUtility.AppendTrailingSlash(mainRoot) + FilesFolder; files.LargeImageUrl = "~/DesktopModules/CoreModules/FileBrowser/img/32/folder-document-alt.png"; files.SmallImageUrl = "~/DesktopModules/CoreModules/FileBrowser/img/16/folder-document-alt.png"; // Display text of root folders are localized using WebFileBrowser resources files // in "/App_GlobalResources/WebFileManager" and GetResoueceString method // of FileManager.Controller class files.Text = FileManager1.Controller.GetResourceString("Root_File", "Files"); FileManager1.RootDirectories.Add(files); flash = new RootDirectory(); flash.ShowRootIndex = false; flash.DirectoryPath = VirtualPathUtility.AppendTrailingSlash(mainRoot) + FlashFolder; flash.LargeImageUrl = "~/DesktopModules/CoreModules/FileBrowser/img/32/folder-flash.png"; flash.SmallImageUrl = "~/DesktopModules/CoreModules/FileBrowser/img/16/folder-flash.png"; flash.Text = FileManager1.Controller.GetResourceString("Root_Flash", "Flash Movies"); FileManager1.RootDirectories.Add(flash); images = new RootDirectory(); images.ShowRootIndex = false; images.DirectoryPath = VirtualPathUtility.AppendTrailingSlash(mainRoot) + ImageFolder; images.Text = FileManager1.Controller.GetResourceString("Root_Image", "Images"); images.LargeImageUrl = "~/DesktopModules/CoreModules/FileBrowser/img/32/camera.png"; images.SmallImageUrl = "~/DesktopModules/CoreModules/FileBrowser/img/16/camera.png"; FileManager1.RootDirectories.Add(images); media = new RootDirectory(); media.ShowRootIndex = false; media.DirectoryPath = VirtualPathUtility.AppendTrailingSlash(mainRoot) + MediaFolder; media.LargeImageUrl = "~/DesktopModules/CoreModules/FileBrowser/img/32/folder-video-alt.png"; media.SmallImageUrl = "~/DesktopModules/CoreModules/FileBrowser/img/16/folder-video-alt.png"; media.Text = FileManager1.Controller.GetResourceString("Root_Media", "Media"); FileManager1.RootDirectories.Add(media); break; } } } if (UseCustomRoots) { // Memorizza il parametro querystring "cs" che consente di visualizzare una sola customroot int selectedCustomRoot; if (!int.TryParse(Request["cs"], out selectedCustomRoot)) { selectedCustomRoot = -1; } // Folder containing custom roots icon images string rootsImageFolder = String.IsNullOrEmpty(HF_CustomRoots.Attributes[ROOTS_IMAGEFOLDER]) ? "" : HF_CustomRoots.Attributes[ROOTS_IMAGEFOLDER]; //Arrays: roots names, roots folders, small icons, large icons string[] rootsNames, rootsFolders, rootsSmallImages, rootsLargeImages; // Convert data-roots-names value in array string temp = String.IsNullOrEmpty(HF_CustomRoots.Attributes[ROOTS_NAMES]) ? "" : HF_CustomRoots.Attributes[ROOTS_NAMES]; if (temp == "") { return; } rootsNames = temp.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); // Count of custom roots int rootsCount = rootsNames.Length; // If data-roots-folder is empty, will use root names if (String.IsNullOrEmpty(HF_CustomRoots.Attributes[ROOTS_FOLDERS])) { rootsFolders = temp.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); } else { rootsFolders = HF_CustomRoots.Attributes[ROOTS_FOLDERS].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); } if (rootsCount > rootsFolders.Length) { rootsCount = rootsFolders.Length; } if (!String.IsNullOrEmpty(HF_CustomRoots.Attributes[ROOTS_SMALLIMAGES])) { rootsSmallImages = HF_CustomRoots.Attributes[ROOTS_SMALLIMAGES].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); if (rootsCount > rootsSmallImages.Length) { rootsCount = rootsSmallImages.Length; } } else { rootsSmallImages = new string[] { }; rootsCount = 0; } if (!String.IsNullOrEmpty(HF_CustomRoots.Attributes[ROOTS_LARGEIMAGES])) { rootsLargeImages = HF_CustomRoots.Attributes[ROOTS_LARGEIMAGES].Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); if (rootsCount > rootsLargeImages.Length) { rootsCount = rootsLargeImages.Length; } } else { rootsLargeImages = new string[] { }; rootsCount = 0; } if (rootsCount == 0) { throw new Exception("If UseCustomRoots option is setted you must provide Custom Roots full info (Names, Folders, small an large images)."); } else { if (selectedCustomRoot >= 0 && selectedCustomRoot < rootsCount) { mainRootInfo.CreateSubdirectory(rootsFolders[selectedCustomRoot]); RootDirectory myCustomRoot = new RootDirectory(); myCustomRoot.ShowRootIndex = false; myCustomRoot.DirectoryPath = VirtualPathUtility.AppendTrailingSlash(mainRoot) + rootsFolders[selectedCustomRoot]; myCustomRoot.LargeImageUrl = VirtualPathUtility.AppendTrailingSlash(rootsImageFolder) + rootsLargeImages[selectedCustomRoot]; myCustomRoot.SmallImageUrl = VirtualPathUtility.AppendTrailingSlash(rootsImageFolder) + rootsLargeImages[selectedCustomRoot]; myCustomRoot.Text = rootsNames[selectedCustomRoot]; FileManager1.RootDirectories.Add(myCustomRoot); } else { for (int i = 0; i < rootsCount; i++) { mainRootInfo.CreateSubdirectory(rootsFolders[i]); RootDirectory myCustomRoot = new RootDirectory(); myCustomRoot.ShowRootIndex = false; myCustomRoot.DirectoryPath = VirtualPathUtility.AppendTrailingSlash(mainRoot) + rootsFolders[i]; myCustomRoot.LargeImageUrl = VirtualPathUtility.AppendTrailingSlash(rootsImageFolder) + rootsLargeImages[i]; myCustomRoot.SmallImageUrl = VirtualPathUtility.AppendTrailingSlash(rootsImageFolder) + rootsLargeImages[i]; myCustomRoot.Text = rootsNames[i]; FileManager1.RootDirectories.Add(myCustomRoot); } } } } } AccessMode fbAccessMode; if (MagicSession.Current.FileBrowserAccessMode == AccessMode.Default) { fbAccessMode = FileManager1.DefaultAccessMode; } else { fbAccessMode = MagicSession.Current.FileBrowserAccessMode; } Literal content; switch (fbAccessMode) { case AccessMode.Delete: FileManager1.Visible = true; Panel_upload.Visible = true; Panel_deny.Visible = false; FileManager1.ReadOnly = false; FileManager1.AllowDelete = true; FileManager1.AllowOverwrite = true; break; case AccessMode.DenyAll: FileManager1.Visible = false; Panel_upload.Visible = false; Panel_deny.Visible = true; content = new Literal(); content.Text = "<h1>" + FileManager1.Controller.GetResourceString("Upload_Error_3", "User does not have sufficient privileges.") + "<br/> </h1>"; Panel_deny.Controls.Add(content); break; case AccessMode.ReadOnly: case AccessMode.Default: FileManager1.Visible = true; Panel_upload.Visible = false; Panel_deny.Visible = false; FileManager1.ReadOnly = true; if (HideCommands) { FileManager1.ShowToolBar = false; FileManager1.EnableContextMenu = false; Panel_upload.Visible = true; Upload_button.Visible = false; DND_message.InnerText = FileManager1.Controller.GetResourceString("No_Command_Help", "DoubleClick to open a folder. DoubleClick to download a file."); } break; case AccessMode.Write: FileManager1.Visible = true; Panel_upload.Visible = true; Panel_deny.Visible = false; FileManager1.ReadOnly = false; FileManager1.AllowDelete = false; FileManager1.AllowOverwrite = false; break; default: break; } }
/// <summary> /// The BindData helper method is used to populate a asp:datalist /// server control with the current "edit access" permissions /// set within the portal configuration system /// </summary> private void BindData() { bool useNTLM = HttpContext.Current.User is System.Security.Principal.WindowsPrincipal; // add by Jonathan Fong 22/07/2004 to support LDAP useNTLM |= System.Configuration.ConfigurationSettings.AppSettings["LDAPLogin"] != null ? true : false; authAddRoles.Visible = authApproveRoles.Visible = authDeleteRoles.Visible = authEditRoles.Visible = authPropertiesRoles.Visible = authPublishingRoles.Visible = authMoveModuleRoles.Visible = authDeleteModuleRoles.Visible = authViewRoles.Visible = !useNTLM; memAddRoles.Visible = memApproveRoles.Visible = memDeleteRoles.Visible = memEditRoles.Visible = memPropertiesRoles.Visible = memPublishingRoles.Visible = memMoveModuleRoles.Visible = memDeleteModuleRoles.Visible = memViewRoles.Visible = useNTLM; object value = GetModule(); if (value != null) { ModuleSettings m = (ModuleSettings)value; moduleType.Text = giveMeFriendlyName(m.GuidID); // Update Textbox Settings moduleTitle.Text = m.ModuleTitle; cacheTime.Text = m.CacheTime.ToString(); portalTabs = new TabsDB().GetTabsFlat(portalSettings.PortalID); tabDropDownList.DataBind(); tabDropDownList.ClearSelection(); if (tabDropDownList.Items.FindByValue(m.TabID.ToString()) != null) { tabDropDownList.Items.FindByValue(m.TabID.ToString()).Selected = true; } // Change by [email protected] //Date: 19/5/2003 showEveryWhere.Checked = m.ShowEveryWhere; // is the window mgmt support enabled allowCollapsable.Enabled = Rainbow.BLL.Utils.GlobalResources.SupportWindowMgmt; allowCollapsable.Checked = m.SupportCollapsable; ShowMobile.Checked = m.ShowMobile; // Change by [email protected] // Date: 6/2/2003 PortalModuleControl pm; string controlPath; controlPath = Rainbow.Settings.Path.WebPathCombine(Rainbow.Settings.Path.ApplicationRoot, m.DesktopSrc); try { pm = (PortalModuleControl)LoadControl(controlPath); if (pm.InnerSupportsWorkflow) { enableWorkflowSupport.Checked = m.SupportWorkflow; if (useNTLM) { memApproveRoles.Enabled = m.SupportWorkflow; memPublishingRoles.Enabled = m.SupportWorkflow; memApproveRoles.Members = m.AuthorizedApproveRoles; memPublishingRoles.Members = m.AuthorizedPublishingRoles; } else { authApproveRoles.Enabled = m.SupportWorkflow; authPublishingRoles.Enabled = m.SupportWorkflow; populateRoles(ref authPublishingRoles, m.AuthorizedPublishingRoles); populateRoles(ref authApproveRoles, m.AuthorizedApproveRoles); } } else { enableWorkflowSupport.Enabled = false; if (useNTLM) { memApproveRoles.Enabled = false; memPublishingRoles.Enabled = false; } else { authApproveRoles.Enabled = false; authPublishingRoles.Enabled = false; } } } catch (Exception ex) { Rainbow.Configuration.ErrorHandler.HandleException("There was a problem loading: '" + controlPath + "'", ex); throw; } // End Change [email protected] // Populate checkbox list with all security roles for this portal // and "check" the ones already configured for this module if (useNTLM) { memEditRoles.Members = m.AuthorizedEditRoles; memViewRoles.Members = m.AuthorizedViewRoles; memAddRoles.Members = m.AuthorizedAddRoles; memDeleteRoles.Members = m.AuthorizedDeleteRoles; memMoveModuleRoles.Members = m.AuthorizedMoveModuleRoles; memDeleteModuleRoles.Members = m.AuthorizedDeleteModuleRoles; memPropertiesRoles.Members = m.AuthorizedPropertiesRoles; } else { populateRoles(ref authEditRoles, m.AuthorizedEditRoles); populateRoles(ref authViewRoles, m.AuthorizedViewRoles); populateRoles(ref authAddRoles, m.AuthorizedAddRoles); populateRoles(ref authDeleteRoles, m.AuthorizedDeleteRoles); populateRoles(ref authMoveModuleRoles, m.AuthorizedMoveModuleRoles); populateRoles(ref authDeleteModuleRoles, m.AuthorizedDeleteModuleRoles); populateRoles(ref authPropertiesRoles, m.AuthorizedPropertiesRoles); } // Jes1111 if (!pm.Cacheable) { cacheTime.Text = "-1"; cacheTime.Enabled = false; } } else // Denied access if Module not in Tab. [email protected] (2004/07/23) { PortalSecurity.AccessDenied(); } }