Ejemplo n.º 1
0
        /// <summary>
        /// 实现IConfigurationSectionHandler接口Create方法
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="configContext"></param>
        /// <param name="section"></param>
        /// <returns></returns>
        public object Create(Object parent, Object configContext, System.Xml.XmlNode section)
        {
            Permission P_Mission = new Permission();
            XmlNode AppNode = section.SelectSingleNode("ApplicationID");
            P_Mission.ApplicationID = Convert.ToInt32(AppNode.InnerText);
            P_Mission.ApplicationName = AppNode.Attributes["name"].Value;
            AppNode = section.SelectSingleNode("PageCode");
            P_Mission.PageCode = AppNode.InnerText;
            P_Mission.PageCodeName = AppNode.Attributes["name"].Value;

            List<string> Files = Common.GetDirFileList("aspx");
            XmlNodeList ItemNodes = section.SelectNodes("Item");
            foreach (XmlNode Node in ItemNodes)
            {
                PermissionItem Item = new PermissionItem();
                Item.Item_Name = Node.Attributes["name"].Value;
                Item.Item_Value = Convert.ToInt32(Node.Attributes["value"].Value);
                Item.Item_FileList = Node.InnerText.ToLower();               
                P_Mission.ItemList.Add(Item);
                if (Item.Item_FileList.Trim() != "")
                {
                    RemoveFile(Files, Item.Item_FileList.Trim());
                }                
            }
            UpdatePermissionConfig(P_Mission, Files);
            
            return P_Mission;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 更新权限配置文件表
 /// </summary>
 /// <param name="P_Mission">权限配置</param>
 /// <param name="Files">文件名</param>
 private void UpdatePermissionConfig(Permission P_Mission, List<string> Files)
 {
     if (Files.Count > 0)
     {
         PermissionItem Item = new PermissionItem();
         Item.Item_Value = 2;
         Item.Item_Name = "Look";
         Item.Item_FileList = "";
         foreach (string var in Files)
         {
             Item.Item_FileList = string.Format(",{0}{1}", var, Item.Item_FileList);
         }
         Item.Item_FileList = Item.Item_FileList + ",";
         P_Mission.ItemList.Add(Item);
     }
 }