private static void ClearPermissionCache(int moduleId)
 {
     ModuleController objModules = new ModuleController();
     ModuleInfo objModule = objModules.GetModule(moduleId, Null.NullInteger, false);
     DataCache.ClearModulePermissionsCache(objModule.TabID);
 }
 private static void GetModuleContent(XmlNode nodeModule, int ModuleId, int TabId, int PortalId)
 {
     ModuleController objModules = new ModuleController();
     ModuleInfo objModule = objModules.GetModule(ModuleId, TabId, true);
     string strVersion = nodeModule.SelectSingleNode("content").Attributes["version"].Value;
     string strType = nodeModule.SelectSingleNode("content").Attributes["type"].Value;
     string strcontent = nodeModule.SelectSingleNode("content").InnerXml;
     strcontent = strcontent.Substring(9, strcontent.Length - 12);
     if (!String.IsNullOrEmpty(objModule.DesktopModule.BusinessControllerClass) && !String.IsNullOrEmpty(strcontent))
     {
         PortalInfo objportal;
         PortalController objportals = new PortalController();
         objportal = objportals.GetPortal(PortalId);
         if (objModule.DesktopModule.SupportedFeatures == Null.NullInteger)
         {
             CreateEventQueueMessage(objModule, strcontent, strVersion, objportal.AdministratorId);
         }
         else
         {
             strcontent = HttpContext.Current.Server.HtmlDecode(strcontent);
             if (objModule.DesktopModule.IsPortable)
             {
                 try
                 {
                     object objObject = Framework.Reflection.CreateObject(objModule.DesktopModule.BusinessControllerClass, objModule.DesktopModule.BusinessControllerClass);
                     if (objObject is IPortable)
                     {
                         ((IPortable)objObject).ImportModule(objModule.ModuleID, strcontent, strVersion, objportal.AdministratorId);
                     }
                 }
                 catch
                 {
                     CreateEventQueueMessage(objModule, strcontent, strVersion, objportal.AdministratorId);
                 }
             }
         }
     }
 }
 protected void AddExistingModule(int moduleId, int tabId, string paneName, int position, string align)
 {
     ModuleController objModules = new ModuleController();
     ModuleInfo objModule;
     Services.Log.EventLog.EventLogController objEventLog = new Services.Log.EventLog.EventLogController();
     int UserId = -1;
     if (Request.IsAuthenticated)
     {
         UserInfo objUserInfo = UserController.GetCurrentUserInfo();
         UserId = objUserInfo.UserID;
     }
     objModule = objModules.GetModule(moduleId, tabId, false);
     if (objModule != null)
     {
         ModuleInfo objClone = objModule.Clone();
         objClone.TabID = PortalSettings.ActiveTab.TabID;
         objClone.ModuleOrder = position;
         objClone.PaneName = paneName;
         objClone.Alignment = align;
         objModules.AddModule(objClone);
         objEventLog.AddLog(objClone, PortalSettings, UserId, "", Services.Log.EventLog.EventLogController.EventLogType.MODULE_CREATED);
     }
 }
示例#4
0
 private bool ProcessSlaveModule()
 {
     ModuleController objModules = new ModuleController();
     ModuleInfo objModule = null;
     ModuleInfo slaveModule = null;
     int moduleId = -1;
     string key = "";
     bool bSuccess = true;
     if (Request.QueryString["mid"] != null)
     {
         Int32.TryParse(Request.QueryString["mid"], out moduleId);
     }
     if (Request.QueryString["ctl"] != null)
     {
         key = Request.QueryString["ctl"];
     }
     if (Request.QueryString["moduleid"] != null && (key.ToLower() == "module" || key.ToLower() == "help"))
     {
         Int32.TryParse(Request.QueryString["moduleid"], out moduleId);
     }
     if (moduleId != -1)
     {
         objModule = objModules.GetModule(moduleId, PortalSettings.ActiveTab.TabID, false);
         if (objModule != null)
         {
             slaveModule = objModule.Clone();
         }
     }
     if (slaveModule == null)
     {
         slaveModule = new ModuleInfo();
         slaveModule.ModuleID = moduleId;
         slaveModule.ModuleDefID = -1;
         slaveModule.TabID = PortalSettings.ActiveTab.TabID;
     }
     if (Request.QueryString["moduleid"] != null && (key.ToLower() == "module" || key.ToLower() == "help"))
     {
         slaveModule.ModuleDefID = -1;
     }
     if (Request.QueryString["dnnprintmode"] != "true")
     {
         slaveModule.ModuleTitle = "";
     }
     slaveModule.Header = "";
     slaveModule.Footer = "";
     slaveModule.StartDate = DateTime.MinValue;
     slaveModule.EndDate = DateTime.MaxValue;
     slaveModule.PaneName = Common.Globals.glbDefaultPane;
     slaveModule.Visibility = VisibilityState.None;
     slaveModule.Color = "";
     slaveModule.Border = "";
     slaveModule.DisplayTitle = true;
     slaveModule.DisplayPrint = false;
     slaveModule.DisplaySyndicate = false;
     slaveModule.ContainerSrc = PortalSettings.ActiveTab.ContainerSrc;
     if (string.IsNullOrEmpty(slaveModule.ContainerSrc))
     {
         slaveModule.ContainerSrc = PortalSettings.DefaultPortalContainer;
     }
     slaveModule.ContainerSrc = SkinController.FormatSkinSrc(slaveModule.ContainerSrc, PortalSettings);
     slaveModule.ContainerPath = SkinController.FormatSkinPath(slaveModule.ContainerSrc);
     Pane pane = null;
     bool bFound = Panes.TryGetValue(Common.Globals.glbDefaultPane.ToLowerInvariant(), out pane);
     ModuleControlInfo objModuleControl = ModuleControlController.GetModuleControlByControlKey(key, slaveModule.ModuleDefID);
     if (objModuleControl != null)
     {
         slaveModule.ModuleControlId = objModuleControl.ModuleControlID;
         slaveModule.IconFile = objModuleControl.IconFile;
         if (ModulePermissionController.HasModuleAccess(slaveModule.ModuleControl.ControlType, Null.NullString, slaveModule))
         {
             bSuccess = InjectModule(pane, slaveModule);
         }
         else
         {
             Response.Redirect(Common.Globals.AccessDeniedURL(MODULEACCESS_ERROR), true);
         }
     }
     return bSuccess;
 }
 protected void AddNewModule(string title, int desktopModuleId, string paneName, int position, ViewPermissionType permissionType, string align)
 {
     TabPermissionCollection objTabPermissions = PortalSettings.ActiveTab.TabPermissions;
     PermissionController objPermissionController = new PermissionController();
     ModuleController objModules = new ModuleController();
     Services.Log.EventLog.EventLogController objEventLog = new Services.Log.EventLog.EventLogController();
     int j;
     try
     {
         DesktopModuleInfo desktopModule = null;
         if (!DesktopModuleController.GetDesktopModules(PortalSettings.PortalId).TryGetValue(desktopModuleId, out desktopModule))
         {
             throw new ArgumentException("desktopModuleId");
         }
     }
     catch (Exception ex)
     {
         Exceptions.LogException(ex);
     }
     int UserId = -1;
     if (Request.IsAuthenticated)
     {
         UserInfo objUserInfo = UserController.GetCurrentUserInfo();
         UserId = objUserInfo.UserID;
     }
     foreach (ModuleDefinitionInfo objModuleDefinition in ModuleDefinitionController.GetModuleDefinitionsByDesktopModuleID(desktopModuleId).Values)
     {
         ModuleInfo objModule = new ModuleInfo();
         objModule.Initialize(PortalSettings.PortalId);
         objModule.PortalID = PortalSettings.PortalId;
         objModule.TabID = PortalSettings.ActiveTab.TabID;
         objModule.ModuleOrder = position;
         if (String.IsNullOrEmpty(title))
         {
             objModule.ModuleTitle = objModuleDefinition.FriendlyName;
         }
         else
         {
             objModule.ModuleTitle = title;
         }
         objModule.PaneName = paneName;
         objModule.ModuleDefID = objModuleDefinition.ModuleDefID;
         if (objModuleDefinition.DefaultCacheTime > 0)
         {
             objModule.CacheTime = objModuleDefinition.DefaultCacheTime;
             if (PortalSettings.Current.DefaultModuleId > Null.NullInteger && PortalSettings.Current.DefaultTabId > Null.NullInteger)
             {
                 ModuleInfo defaultModule = objModules.GetModule(PortalSettings.Current.DefaultModuleId, PortalSettings.Current.DefaultTabId, true);
                 if (defaultModule != null)
                 {
                     objModule.CacheTime = defaultModule.CacheTime;
                 }
             }
         }
         switch (permissionType)
         {
             case ViewPermissionType.View:
                 objModule.InheritViewPermissions = true;
                 break;
             case ViewPermissionType.Edit:
                 objModule.InheritViewPermissions = false;
                 break;
         }
         ArrayList arrSystemModuleViewPermissions = objPermissionController.GetPermissionByCodeAndKey("SYSTEM_MODULE_DEFINITION", "VIEW");
         foreach (TabPermissionInfo objTabPermission in objTabPermissions)
         {
             if (objTabPermission.PermissionKey == "VIEW" && permissionType == ViewPermissionType.View)
             {
                 continue;
             }
             ArrayList arrSystemModulePermissions = objPermissionController.GetPermissionByCodeAndKey("SYSTEM_MODULE_DEFINITION", objTabPermission.PermissionKey);
             for (j = 0; j <= arrSystemModulePermissions.Count - 1; j++)
             {
                 PermissionInfo objSystemModulePermission;
                 objSystemModulePermission = (PermissionInfo)arrSystemModulePermissions[j];
                 if (objSystemModulePermission.PermissionKey == "VIEW" && permissionType == ViewPermissionType.Edit && objTabPermission.PermissionKey != "EDIT")
                 {
                     continue;
                 }
                 ModulePermissionInfo objModulePermission = AddModulePermission(objModule, objSystemModulePermission, objTabPermission.RoleID, objTabPermission.UserID, objTabPermission.AllowAccess);
                 if (objModulePermission.PermissionKey == "EDIT" && objModulePermission.AllowAccess)
                 {
                     ModulePermissionInfo objModuleViewperm = AddModulePermission(objModule, (PermissionInfo)arrSystemModuleViewPermissions[0], objModulePermission.RoleID, objModulePermission.UserID, true);
                 }
             }
             if (objTabPermission.PermissionKey == "EDIT")
             {
                 ArrayList arrCustomModulePermissions = objPermissionController.GetPermissionsByModuleDefID(objModule.ModuleDefID);
                 for (j = 0; j <= arrCustomModulePermissions.Count - 1; j++)
                 {
                     PermissionInfo objCustomModulePermission;
                     objCustomModulePermission = (PermissionInfo)arrCustomModulePermissions[j];
                     AddModulePermission(objModule, objCustomModulePermission, objTabPermission.RoleID, objTabPermission.UserID, objTabPermission.AllowAccess);
                 }
             }
         }
         objModule.AllTabs = false;
         objModule.Alignment = align;
         objModules.AddModule(objModule);
     }
 }