예제 #1
0
 private string ReplaceSecurityLayerParameters(string xml, SecurityLayerGridObject securityLayer)
 {
     if (securityLayer.OldName != securityLayer.Name)
     {
         xml = xml.Replace("<Name>" + securityLayer.OldName + "</Name>", "<Name>" + securityLayer.Name + "</Name>");
     }
     if (securityLayer.OldLabel != securityLayer.Label)
     {
         xml = xml.Replace("<Label>" + securityLayer.OldLabel + "</Label>", "<Label>" + securityLayer.Label + "</Label>");
     }
     if (securityLayer.OldDescription != securityLayer.Description)
     {
         xml = xml.Replace("<Description>" + securityLayer.OldDescription + "</Description>", "<Description>" + securityLayer.Description + "</Description>");
     }
     return(xml);
 }
예제 #2
0
        private List <SecurityLayerGridObject> ConvertGridToObjects()
        {
            List <SecurityLayerGridObject> securityLayers = new List <SecurityLayerGridObject>();
            int count = dgvSecurityLayers.RowCount;

            for (int index = 0; index < count; index++)
            {
                DataGridViewRow         row = dgvSecurityLayers.Rows[index];
                SecurityLayerGridObject sl  = new SecurityLayerGridObject()
                {
                    Selected       = (bool)row.Cells["Selected"].Value,
                    OldName        = (string)row.Cells["OldName"].Value,
                    Name           = (string)row.Cells["Name"].Value,
                    OldLabel       = (string)row.Cells["OldLabel"].Value,
                    Label          = (string)row.Cells["Label"].Value,
                    OldDescription = (string)row.Cells["OldDescription"].Value,
                    Description    = (string)row.Cells["Description"].Value,
                    Type           = (string)row.Cells["Type"].Value
                };
                securityLayers.Add(sl);
            }
            return(securityLayers);
        }
예제 #3
0
        private List <SecurityLayerGridObject> ParseInputXML(string inputFilePath)
        {
            List <SecurityLayerGridObject> securityLayerList = new List <SecurityLayerGridObject>();
            XmlDocument xDoc = new XmlDocument();

            xDoc.Load(inputFilePath);
            XmlNodeList roles = xDoc.GetElementsByTagName("AxSecurityRole");

            foreach (XmlNode role in roles)
            {
                string roleName = role["Name"]?.InnerText;
                if (roleName != null)
                {
                    SecurityLayerGridObject sl = new SecurityLayerGridObject
                    {
                        Selected       = false,
                        OldName        = roleName,
                        Name           = roleName,
                        OldLabel       = role["Label"]?.InnerText ?? "",
                        Label          = role["Label"]?.InnerText ?? "",
                        OldDescription = role["Description"]?.InnerText ?? "",
                        Description    = role["Description"]?.InnerText ?? "",
                        Type           = "Role"
                    };
                    securityLayerList.Add(sl);
                }
            }

            XmlNodeList duties = xDoc.GetElementsByTagName("AxSecurityDuty");

            foreach (XmlNode duty in duties)
            {
                string dutyName = duty["Name"]?.InnerText;
                if (dutyName != null)
                {
                    SecurityLayerGridObject sl = new SecurityLayerGridObject
                    {
                        Selected       = false,
                        OldName        = dutyName,
                        Name           = dutyName,
                        OldLabel       = duty["Label"]?.InnerText ?? "",
                        Label          = duty["Label"]?.InnerText ?? "",
                        OldDescription = duty["Description"]?.InnerText ?? "",
                        Description    = duty["Description"]?.InnerText ?? "",
                        Type           = "Duty"
                    };
                    securityLayerList.Add(sl);
                }
            }

            XmlNodeList privileges = xDoc.GetElementsByTagName("AxSecurityPrivilege");

            foreach (XmlNode privilege in privileges)
            {
                string privilegeName = privilege["Name"]?.InnerText;
                if (privilegeName != null)
                {
                    SecurityLayerGridObject sl = new SecurityLayerGridObject
                    {
                        Selected       = false,
                        OldName        = privilegeName,
                        Name           = privilegeName,
                        OldLabel       = privilege["Label"]?.InnerText ?? "",
                        Label          = privilege["Label"]?.InnerText ?? "",
                        OldDescription = privilege["Description"]?.InnerText ?? "",
                        Description    = privilege["Description"]?.InnerText ?? "",
                        Type           = "Privilege"
                    };
                    securityLayerList.Add(sl);
                }
            }
            return(securityLayerList);
        }