当前位置: 首页>>代码示例>>C#>>正文


C# PermissionController.GetPermissionsByModuleDefID方法代码示例

本文整理汇总了C#中DotNetNuke.Security.Permissions.PermissionController.GetPermissionsByModuleDefID方法的典型用法代码示例。如果您正苦于以下问题:C# PermissionController.GetPermissionsByModuleDefID方法的具体用法?C# PermissionController.GetPermissionsByModuleDefID怎么用?C# PermissionController.GetPermissionsByModuleDefID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DotNetNuke.Security.Permissions.PermissionController的用法示例。


在下文中一共展示了PermissionController.GetPermissionsByModuleDefID方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddNewModule


//.........这里部分代码省略.........
                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 = ModuleController.Instance.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;
                }
				
                //get the default module view permissions
                ArrayList arrSystemModuleViewPermissions = objPermissionController.GetPermissionByCodeAndKey("SYSTEM_MODULE_DEFINITION", "VIEW");

                //get the permissions from the page
                foreach (TabPermissionInfo objTabPermission in objTabPermissions)
                {
                    if (objTabPermission.PermissionKey == "VIEW" && permissionType == ViewPermissionType.View)
                    {
						//Don't need to explicitly add View permisisons if "Same As Page"
                        continue;
                    }
					
                    //get the system module permissions for the permissionkey
                    ArrayList arrSystemModulePermissions = objPermissionController.GetPermissionByCodeAndKey("SYSTEM_MODULE_DEFINITION", objTabPermission.PermissionKey);
                    //loop through the system module permissions
                    int j;
                    for (j = 0; j <= arrSystemModulePermissions.Count - 1; j++)
                    {
                        PermissionInfo objSystemModulePermission;
                        objSystemModulePermission = (PermissionInfo) arrSystemModulePermissions[j];
                        if (objSystemModulePermission.PermissionKey == "VIEW" && permissionType == ViewPermissionType.Edit && objTabPermission.PermissionKey != "EDIT")
                        {
							//Only Page Editors get View permissions if "Page Editors Only"
                            continue;
                        }
                        ModulePermissionInfo objModulePermission = AddModulePermission(objModule,
                                                                                       objSystemModulePermission,
                                                                                       objTabPermission.RoleID,
                                                                                       objTabPermission.UserID,
                                                                                       objTabPermission.AllowAccess);

                        //ensure that every EDIT permission which allows access also provides VIEW permission
                        if (objModulePermission.PermissionKey == "EDIT" && objModulePermission.AllowAccess)
                        {
                            ModulePermissionInfo objModuleViewperm = AddModulePermission(objModule,
                                                                                         (PermissionInfo) arrSystemModuleViewPermissions[0],
                                                                                         objModulePermission.RoleID,
                                                                                         objModulePermission.UserID,
                                                                                         true);
                        }
                    }
					
                    //Get the custom Module Permissions,  Assume that roles with Edit Tab Permissions
                    //are automatically assigned to the Custom Module Permissions
                    if (objTabPermission.PermissionKey == "EDIT")
                    {
                        ArrayList arrCustomModulePermissions = objPermissionController.GetPermissionsByModuleDefID(objModule.ModuleDefID);

                        //loop through the custom module permissions
                        for (j = 0; j <= arrCustomModulePermissions.Count - 1; j++)
                        {
							//create the module permission
                            PermissionInfo objCustomModulePermission;
                            objCustomModulePermission = (PermissionInfo) arrCustomModulePermissions[j];
                            AddModulePermission(objModule, objCustomModulePermission, objTabPermission.RoleID, objTabPermission.UserID, objTabPermission.AllowAccess);
                        }
                    }
                }

                if (PortalSettings.Current.ContentLocalizationEnabled)
                {
                    Locale defaultLocale = LocaleController.Instance.GetDefaultLocale(PortalSettings.Current.PortalId);
                    //set the culture of the module to that of the tab
                    var tabInfo = TabController.Instance.GetTab(objModule.TabID, PortalSettings.Current.PortalId, false);
                    objModule.CultureCode = tabInfo != null ? tabInfo.CultureCode : defaultLocale.Code;
                }
                else
                {
                    objModule.CultureCode = Null.NullString;
                }

                objModule.AllTabs = false;
                objModule.Alignment = align;
                ModuleController.Instance.AddModule(objModule);
            }
        }
开发者ID:rjallepalli,项目名称:PIX_CMS,代码行数:101,代码来源:ControlPanelBase.cs

示例2: InitialModulePermission

		public void InitialModulePermission(ModuleInfo module, int tabId, int permissionType)
		{
			var tabPermissions = TabPermissionController.GetTabPermissions(tabId, module.PortalID);
            var permissionController = new PermissionController();

            module.InheritViewPermissions = permissionType == 0;

            // get the default module view permissions
            ArrayList systemModuleViewPermissions = permissionController.GetPermissionByCodeAndKey("SYSTEM_MODULE_DEFINITION", "VIEW");

            // get the permissions from the page
			foreach (TabPermissionInfo tabPermission in tabPermissions)
			{
				if (tabPermission.PermissionKey == "VIEW" && permissionType == 0)
				{
					//Don't need to explicitly add View permisisons if "Same As Page"
					continue;
				}

				// get the system module permissions for the permissionkey
				ArrayList systemModulePermissions = permissionController.GetPermissionByCodeAndKey("SYSTEM_MODULE_DEFINITION", tabPermission.PermissionKey);
				// loop through the system module permissions
				int j;
				for (j = 0; j <= systemModulePermissions.Count - 1; j++)
				{
					// create the module permission
					var systemModulePermission = (PermissionInfo) systemModulePermissions[j];
					if (systemModulePermission.PermissionKey == "VIEW" && permissionType == 1 && tabPermission.PermissionKey != "EDIT")
					{
						//Only Page Editors get View permissions if "Page Editors Only"
						continue;
					}

					ModulePermissionInfo modulePermission = AddModulePermission(module, systemModulePermission, tabPermission.RoleID, tabPermission.UserID, tabPermission.AllowAccess);

					// ensure that every EDIT permission which allows access also provides VIEW permission
					if (modulePermission.PermissionKey == "EDIT" && modulePermission.AllowAccess)
					{
						AddModulePermission(module, (PermissionInfo) systemModuleViewPermissions[0], modulePermission.RoleID, modulePermission.UserID, true);
					}
				}

				//Get the custom Module Permissions,  Assume that roles with Edit Tab Permissions
				//are automatically assigned to the Custom Module Permissions
				if (tabPermission.PermissionKey == "EDIT")
				{
					ArrayList customModulePermissions = permissionController.GetPermissionsByModuleDefID(module.ModuleDefID);

					// loop through the custom module permissions
					for (j = 0; j <= customModulePermissions.Count - 1; j++)
					{
						// create the module permission
						var customModulePermission = (PermissionInfo)customModulePermissions[j];

						AddModulePermission(module, customModulePermission, tabPermission.RoleID, tabPermission.UserID, tabPermission.AllowAccess);
					}
				}
			}
		}
开发者ID:rajeshvar,项目名称:Dnn.Platform,代码行数:59,代码来源:ModuleController.cs

示例3: AddNewModule


//.........这里部分代码省略.........
                objModule.TabID = PortalSettings.ActiveTab.TabID;
                objModule.ModuleOrder = position;
                if (String.IsNullOrEmpty(title))
                {
                    objModule.ModuleTitle = objModuleDefinition.FriendlyName;
                }
                else
                {
                    objModule.ModuleTitle = title;
                }

                objModule.ModuleTitle = title;
                objModule.PaneName = paneName;
                objModule.ModuleDefID = objModuleDefinition.ModuleDefID;
                objModule.CacheTime = objModuleDefinition.DefaultCacheTime;

                // initialize module permissions
                ModulePermissionCollection objModulePermissions = new ModulePermissionCollection();
                objModule.ModulePermissions = objModulePermissions;
                objModule.InheritViewPermissions = false;

                // get the default module view permissions
                ArrayList arrSystemModuleViewPermissions = objPermissionController.GetPermissionByCodeAndKey("SYSTEM_MODULE_DEFINITION", "VIEW");

                // get the permissions from the page
                foreach (TabPermissionInfo objTabPermission in objTabPermissions)
                {
                    // get the system module permissions for the permissionkey
                    ArrayList arrSystemModulePermissions = objPermissionController.GetPermissionByCodeAndKey("SYSTEM_MODULE_DEFINITION", objTabPermission.PermissionKey);
                    // loop through the system module permissions
                    int j;
                    for (j = 0; j < arrSystemModulePermissions.Count; j++)
                    {
                        // create the module permission
                        PermissionInfo objSystemModulePermission = (PermissionInfo)(arrSystemModulePermissions[j]);
                        ModulePermissionInfo objModulePermission = AddModulePermission(objModule.ModuleID, objSystemModulePermission, objTabPermission.RoleID);

                        // add the permission to the collection
                        if (!(objModulePermissions.Contains(objModulePermission)) & objModulePermission.AllowAccess)
                        {
                            objModulePermissions.Add(objModulePermission);
                        }

                        // ensure that every EDIT permission which allows access also provides VIEW permission
                        if (objModulePermission.PermissionKey == "EDIT" & objModulePermission.AllowAccess)
                        {
                            ModulePermissionInfo objModuleViewperm = new ModulePermissionInfo();
                            objModuleViewperm.ModuleID = objModulePermission.ModuleID;
                            objModuleViewperm.PermissionID = ((PermissionInfo)(arrSystemModuleViewPermissions[0])).PermissionID;
                            objModuleViewperm.RoleID = objModulePermission.RoleID;
                            objModuleViewperm.PermissionKey = "VIEW";
                            objModuleViewperm.AllowAccess = true;
                            if (!(objModulePermissions.Contains(objModuleViewperm)))
                            {
                                objModulePermissions.Add(objModuleViewperm);
                            }
                        }
                    }

                    //Get the custom Module Permissions,  Assume that roles with Edit Tab Permissions
                    //are automatically assigned to the Custom Module Permissions
                    if (objTabPermission.PermissionKey == "EDIT")
                    {
                        ArrayList arrCustomModulePermissions = objPermissionController.GetPermissionsByModuleDefID(objModule.ModuleDefID);

                        // loop through the custom module permissions
                        for (j = 0; j < arrCustomModulePermissions.Count; j++)
                        {
                            // create the module permission
                            PermissionInfo objCustomModulePermission = (PermissionInfo)(arrCustomModulePermissions[j]);
                            ModulePermissionInfo objModulePermission = AddModulePermission(objModule.ModuleID, objCustomModulePermission, objTabPermission.RoleID);

                            // add the permission to the collection
                            if (!(objModulePermissions.Contains(objModulePermission)) & objModulePermission.AllowAccess)
                            {
                                objModulePermissions.Add(objModulePermission);
                            }
                        }
                    }
                }

                switch (permissionType)
                {
                    case ViewPermissionType.View:
                        objModule.InheritViewPermissions = true;
                        break;
                    case ViewPermissionType.Edit:
                        objModule.ModulePermissions = objModulePermissions;
                        break;
                }

                objModule.AllTabs = false;
                objModule.Visibility = VisibilityState.Maximized;
                objModule.Alignment = align;

                objModules.AddModule(objModule);
                objEventLog.AddLog(objModule, PortalSettings, UserId, "", Services.Log.EventLog.EventLogController.EventLogType.MODULE_CREATED);
            }

        }
开发者ID:huayang912,项目名称:cs-dotnetnuke,代码行数:101,代码来源:ControlPanelBase.ascx.cs

示例4: DeleteModuleDefinition

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// DeleteModuleDefinition deletes a Module Definition By ID
        /// </summary>
        /// <param name="moduleDefinitionId">The ID of the Module Definition to delete</param>
        /// <history>
        /// 	[cnurse]	01/11/2008   Documented
        /// </history>
        /// -----------------------------------------------------------------------------
        public void DeleteModuleDefinition(int moduleDefinitionId)
        {
			//Delete associated permissions
            var permissionController = new PermissionController();
            foreach (PermissionInfo permission in permissionController.GetPermissionsByModuleDefID(moduleDefinitionId))
            {
                permissionController.DeletePermission(permission.PermissionID);
            }
            dataProvider.DeleteModuleDefinition(moduleDefinitionId);
            DataCache.ClearHostCache(true);
        }
开发者ID:davidsports,项目名称:Dnn.Platform,代码行数:20,代码来源:ModuleDefinitionController.cs

示例5: DeleteModuleDefinition

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// DeleteModuleDefinition deletes a Module Definition By ID
        /// </summary>
        /// <param name="moduleDefinitionId">The ID of the Module Definition to delete</param>
        /// <history>
        /// 	[cnurse]	01/11/2008   Documented
        /// </history>
        /// -----------------------------------------------------------------------------
        public void DeleteModuleDefinition(int moduleDefinitionId)
        {
			//Delete associated permissions
            var permissionController = new PermissionController();
            foreach (PermissionInfo permission in permissionController.GetPermissionsByModuleDefID(moduleDefinitionId))
            {
                permissionController.DeletePermission(permission.PermissionID);
            }
            dataProvider.DeleteModuleDefinition(moduleDefinitionId);
            DataCache.ClearHostCache(true);

            // queue remove module definition from search index
            var document = new SearchDocumentToDelete
            {
                ModuleDefId = moduleDefinitionId
            };

            DataProvider.Instance().AddSearchDeletedItems(document);
        }
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:28,代码来源:ModuleDefinitionController.cs


注:本文中的DotNetNuke.Security.Permissions.PermissionController.GetPermissionsByModuleDefID方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。