GetPathWithProtocol() public method

public GetPathWithProtocol ( ) : string
return string
Ejemplo n.º 1
0
 private string GetDefaultDomain(DomainPath domainPath)
 {
     using (DirectoryEntry entry = new DirectoryEntry(domainPath.GetPathWithProtocol()))
     {
         return(entry.Properties["dc"].Value.ToString());
     }
 }
Ejemplo n.º 2
0
        protected virtual IReadOnlyCollection <IPrincipal> GetGroupsWhereUserIsMemberInternal(UserPrincipal principal)
        {
            var        groups     = new List <IPrincipal>();
            DomainPath domainPath = ResolveDomainPath(principal.DomainPath);

            foreach (string parentDomainPath in principal.ParentDomainPaths)
            {
                string path = string.Format("{0}/{1}", domainPath.GetPathWithProtocol(), parentDomainPath);
                using (var entry = new DirectoryEntry(path))
                {
                    groups.Add(Principal.FromDirectoryEntry(domainPath, entry));
                }
            }

            if (!groups.Select(p => p.AccountName).Any(accountName => accountName.ToLower().Contains("domain users")))
            {
                string domain = domains[domainPath];
                groups.Add(GetPrincipalInternal <GroupPrincipal>(string.Format("{0}\\Domain users", domain)));
            }

            return(groups);
        }