Ejemplo n.º 1
0
        public override object Clone()
        {
            var result = new WorkspacePanelItem(Parent, Name);

            result.AdsPath = AdsPath;
            return(result);
        }
Ejemplo n.º 2
0
        public void AsyncFill(PanelItemBase parent, ICollection <PanelItemBase> result)
        {
            string startPath;

            if (parent is UserPanelItem)
            {
                startPath = (parent as UserPanelItem).AdsPath;
            }
            else
            {
                startPath = LdapUtils.GetUserPath(PluginUsers.ScreenService.UserName);
            }

            using (var searcher = new DirectorySearcher())
            {
                // execute filter query to Active Directory
                searcher.SearchRoot = new DirectoryEntry(startPath);
                searcher.PageSize   = Int32.MaxValue;
                searcher.Filter     = "(objectCategory=person)"; // lockoutTime
                searcher.PropertiesToLoad.Add(Constants.MEMBER_OF);
                try
                {
                    var row = searcher.FindOne();

                    var list = row.Properties[Constants.MEMBER_OF];
                    foreach (var value in list)
                    {
                        var valueStr = (string)value;

                        var workspace = new WorkspacePanelItem(parent, LdapUtils.GetLdapValue(valueStr));
                        workspace.AdsPath = valueStr;
                        result.Add(workspace);
                    }
                }
                catch (Exception ex)
                {
                    Debug.Print(ex.Message);
                }
            }
        }