Example #1
0
        public bool FilterListView(Object item)
        {
            LinkageItem SAi = (LinkageItem)item;

            // return (OUFilter.Text.Trim().Length == 0 || Spi.ParentPolicy.IsLinked(OUFilter.Text)) && ((FilterText.Text.Length < 1 || (Spi.Key.ToUpper().Contains(FilterText.Text.ToUpper()) ||
            return((FilterText.Text.Length < 1 || (SAi.ParentPolicy.Name.ToUpper().Contains(FilterText.Text.ToUpper())) || (SAi.Linkage.ToUpper().Contains(FilterText.Text.ToUpper()))));
        }
Example #2
0
        void CopyCmdExecuted(object target, ExecutedRoutedEventArgs e)
        {
            ListView lv = e.OriginalSource as ListView;

            string copyContent = String.Empty;

            int count = 0;

            foreach (object item in lv.SelectedItems)
            {
                if (count > 0)
                {
                    copyContent += Environment.NewLine;
                }

                if (item is LinkageItem)
                {
                    LinkageItem policyItem = (LinkageItem)item;
                    copyContent += policyItem.ParentPolicy.Name + "\t" + policyItem.Linkage;
                }
                count++;
            }

            try
            {
                Clipboard.SetData(DataFormats.Text, copyContent);
            }
            catch
            {
            }
        }
Example #3
0
        private void GetPolicy(object passObj)
        {
            try
            {
                ThreadParameterObj polobj = (ThreadParameterObj)passObj;
                Policy             pol    = polobj.Policy;

                pol.Run();

                GPMGMTLib.GPMGPO name = polobj.GPOPolItem;

                GPMGMTLib.GPM           gpm = new GPMGMTLib.GPM();
                GPMGMTLib.IGPMConstants gpc = gpm.GetConstants();

                GPMGMTLib.IGPMDomain        gpd  = gpm.GetDomain(GetDomainName(), "", polobj.DC);
                GPMGMTLib.GPMSearchCriteria gps  = gpm.CreateSearchCriteria();
                GPMGMTLib.IGPMGPOCollection gpoc = gpd.SearchGPOs(gps);

                GPMGMTLib.GPMSitesContainer gpsc = gpm.GetSitesContainer(polobj.forest, polobj.domain, "", polobj.DC);

                GPMGMTLib.GPMSecurityInfo SecurityInfo = name.GetSecurityInfo();

                foreach (GPMGMTLib.GPMPermission Perm in SecurityInfo)
                {
                    if (Perm.Permission == gpc.permGPOApply)
                    {
                        AssignmentItem assItem = new AssignmentItem();
                        assItem.ParentPolicy = pol;
                        try
                        {
                            assItem.Assignment = Perm.Trustee.TrusteeDomain + "\\" + Perm.Trustee.TrusteeName;

                            pol.AppliedTo.Add(assItem);
                        }
                        catch
                        {
                            assItem.Assignment = Perm.Trustee.TrusteeSid;

                            pol.AppliedTo.Add(assItem);
                        }
                    }
                }

                GPMGMTLib.GPMSearchCriteria SearchLinkage = gpm.CreateSearchCriteria();

                SearchLinkage.Add(gpc.SearchPropertySOMLinks, gpc.SearchOpContains, name);

                foreach (GPMGMTLib.GPMSOM SOM in gpd.SearchSOMs(SearchLinkage))
                {
                    LinkageItem lnkItem = new LinkageItem();
                    lnkItem.ParentPolicy = pol;

                    if (SOM.Type == gpc.somDomain)
                    {
                        lnkItem.Linkage = SOM.Path + "(Domain) - Inheritence Blocked (" + SOM.GPOInheritanceBlocked.ToString() + ")";
                        pol.LinkedTo.Add(lnkItem);
                    }
                    else
                    {
                        lnkItem.Linkage = SOM.Path + "(OU) - Inheritence Blocked (" + SOM.GPOInheritanceBlocked.ToString() + ")";
                        pol.LinkedTo.Add(lnkItem);
                    }
                }


                foreach (GPMGMTLib.GPMSOM SOM in gpsc.SearchSites(SearchLinkage))
                {
                    LinkageItem lnkItem = new LinkageItem();
                    lnkItem.ParentPolicy = pol;
                    lnkItem.Linkage      = SOM.Name + "(Site)";

                    pol.LinkedTo.Add(lnkItem);
                }

                GPMGMTLib.GPMWMIFilter wmifilter = name.GetWMIFilter();

                if (wmifilter != null)
                {
                    Array rawWMIFilters = (Array)wmifilter.GetQueryList();

                    String[] WMIFilters = new String[rawWMIFilters.Length];
                    rawWMIFilters.CopyTo(WMIFilters, 0);


                    foreach (string filter in WMIFilters)
                    {
                        WMIItem wmiItem = new WMIItem();
                        wmiItem.ParentPolicy = pol;
                        wmiItem.WMIFilter    = filter;
                        pol.WMIFilters.Add(wmiItem);
                    }
                }
            }
            catch
            {
            }
            finally
            {
                AddThreadCount(-1);
            }
        }