public ADProviderCommonParameters() { this._formatType = ADProviderDefaults.PathFormat; this._server = ADProviderDefaults.Server; this._isGC = ADProviderDefaults.IsGC; this._authType = ADProviderDefaults.AuthType; }
public static bool IsChildPath(string path, string parentPath, bool includeSelf, ADPathFormat format) { if (string.IsNullOrEmpty(path) || string.IsNullOrEmpty(parentPath)) { if (!includeSelf) { return(false); } else { return(path == parentPath); } } else { ADPathFormat aDPathFormat = format; switch (aDPathFormat) { case ADPathFormat.X500: { return(X500Path.IsChildPath(path, parentPath, includeSelf)); } case ADPathFormat.Canonical: { return(CanonicalPath.IsChildPath(path, parentPath, includeSelf)); } } return(false); } }
public ADProviderCommonParameters() { this._formatType = ADProviderDefaults.PathFormat; this._server = ADProviderDefaults.Server; this._isGC = ADProviderDefaults.IsGC; this._authType = ADProviderDefaults.AuthType; }
public ADDriveInfo() : base(null) { this._formatType = ADProviderDefaults.PathFormat; this._authType = ADProviderDefaults.AuthType; this._isGC = ADProviderDefaults.IsGC; this._ssl = ADProviderDefaults.Ssl; this._encryption = ADProviderDefaults.Encryption; this._signing = ADProviderDefaults.Signing; }
public ADDriveInfo(string name, ProviderInfo provider, string root, string rootWithAbsoluteToken, string description, PSCredential credential) : base(name, provider, rootWithAbsoluteToken, description, credential) { this._formatType = ADProviderDefaults.PathFormat; this._authType = ADProviderDefaults.AuthType; this._isGC = ADProviderDefaults.IsGC; this._ssl = ADProviderDefaults.Ssl; this._encryption = ADProviderDefaults.Encryption; this._signing = ADProviderDefaults.Signing; this._rootWithoutAbsolutePathToken = root; }
static ADProviderDefaults() { ADProviderDefaults.PathFormat = ADPathFormat.X500; ADProviderDefaults.HostType = ADPathHostType.Server; ADProviderDefaults.Server = null; ADProviderDefaults.IsGC = false; ADProviderDefaults.AuthType = ADAuthType.Negotiate; ADProviderDefaults.Ssl = false; ADProviderDefaults.Encryption = true; ADProviderDefaults.Signing = true; ADProviderDefaults.ServerSearchSizeLimit = 0; ADProviderDefaults.ServerSearchPageSize = 0x100; ADProviderDefaults.SearchFilter = "(objectclass=*)"; ADProviderDefaults.InternalProviderSearchPageSize = 0x100; }
static ADProviderDefaults() { ADProviderDefaults.PathFormat = ADPathFormat.X500; ADProviderDefaults.HostType = ADPathHostType.Server; ADProviderDefaults.Server = null; ADProviderDefaults.IsGC = false; ADProviderDefaults.AuthType = ADAuthType.Negotiate; ADProviderDefaults.Ssl = false; ADProviderDefaults.Encryption = true; ADProviderDefaults.Signing = true; ADProviderDefaults.ServerSearchSizeLimit = 0; ADProviderDefaults.ServerSearchPageSize = 0x100; ADProviderDefaults.SearchFilter = "(objectclass=*)"; ADProviderDefaults.InternalProviderSearchPageSize = 0x100; }
public static string ConvertPath(ADSessionInfo sessionInfo, string path, ADPathFormat fromFormat, ADPathFormat toFormat) { string str; if (fromFormat != toFormat) { if (fromFormat == ADPathFormat.Canonical && !string.IsNullOrEmpty(path) && CanonicalPath.IndexOfFirstDelimiter(path) == -1) { path = string.Concat(path, "/"); } using (ADAccountManagement aDAccountManagement = new ADAccountManagement(sessionInfo)) { str = aDAccountManagement.TranslateName(path, fromFormat, toFormat); } return str; } else { return path; } }
public static string ConvertPath(ADSessionInfo sessionInfo, string path, ADPathFormat fromFormat, ADPathFormat toFormat) { string str; if (fromFormat != toFormat) { if (fromFormat == ADPathFormat.Canonical && !string.IsNullOrEmpty(path) && CanonicalPath.IndexOfFirstDelimiter(path) == -1) { path = string.Concat(path, "/"); } using (ADAccountManagement aDAccountManagement = new ADAccountManagement(sessionInfo)) { str = aDAccountManagement.TranslateName(path, fromFormat, toFormat); } return(str); } else { return(path); } }
private ActiveDirectoryNameFormat GetNameFormat(ADPathFormat pathFormat) { ActiveDirectoryNameFormat activeDirectoryNameFormat = ActiveDirectoryNameFormat.DistinguishedName; ADPathFormat aDPathFormat = pathFormat; switch (aDPathFormat) { case ADPathFormat.X500: { activeDirectoryNameFormat = ActiveDirectoryNameFormat.DistinguishedName; break; } case ADPathFormat.Canonical: { activeDirectoryNameFormat = ActiveDirectoryNameFormat.CanonicalName; break; } } return(activeDirectoryNameFormat); }
public static string MakePath(string parent, string child, ADPathFormat format) { if (!string.IsNullOrEmpty(parent) || !string.IsNullOrEmpty(child)) { if (!string.IsNullOrEmpty(parent)) { if (!string.IsNullOrEmpty(child)) { ADPathFormat aDPathFormat = format; switch (aDPathFormat) { case ADPathFormat.X500: { return(X500Path.MakePath(parent, child)); } case ADPathFormat.Canonical: { return(CanonicalPath.MakePath(parent, child)); } } return(null); } else { return(parent); } } else { return(child); } } else { return(""); } }
public static bool ComparePath(string path1, string path2, ADPathFormat format) { if (string.IsNullOrEmpty(path1) || string.IsNullOrEmpty(path2)) { return path1 == path2; } else { ADPathFormat aDPathFormat = format; switch (aDPathFormat) { case ADPathFormat.X500: { return X500Path.ComparePath(path1, path2); } case ADPathFormat.Canonical: { return CanonicalPath.ComparePath(path1, path2); } } return false; } }
public static string GetParentPath(string path, string root, ADPathFormat format) { if (!string.IsNullOrEmpty(path)) { ADPathFormat aDPathFormat = format; switch (aDPathFormat) { case ADPathFormat.X500: { return X500Path.GetParentPath(path, root); } case ADPathFormat.Canonical: { return CanonicalPath.GetParentPath(path, root); } } return null; } else { return ""; } }
public static string GetParentPath(string path, string root, ADPathFormat format) { if (!string.IsNullOrEmpty(path)) { ADPathFormat aDPathFormat = format; switch (aDPathFormat) { case ADPathFormat.X500: { return(X500Path.GetParentPath(path, root)); } case ADPathFormat.Canonical: { return(CanonicalPath.GetParentPath(path, root)); } } return(null); } else { return(""); } }
public static bool ComparePath(string path1, string path2, ADPathFormat format) { if (string.IsNullOrEmpty(path1) || string.IsNullOrEmpty(path2)) { return(path1 == path2); } else { ADPathFormat aDPathFormat = format; switch (aDPathFormat) { case ADPathFormat.X500: { return(X500Path.ComparePath(path1, path2)); } case ADPathFormat.Canonical: { return(CanonicalPath.ComparePath(path1, path2)); } } return(false); } }
internal string TranslateName(string name, ADPathFormat formatOffered, ADPathFormat formatDesired) { this.Init(); TranslateNameRequest translateNameRequest = new TranslateNameRequest(); translateNameRequest.Names = new string[1]; translateNameRequest.Names[0] = name; translateNameRequest.FormatOffered = this.GetNameFormat(formatOffered); translateNameRequest.FormatDesired = this.GetNameFormat(formatDesired); TranslateNameResponse translateNameResponse = this._acctMgmt.TranslateName(this._sessionHandle, translateNameRequest); ActiveDirectoryNameTranslateResult[] nameTranslateResult = translateNameResponse.NameTranslateResult; if (nameTranslateResult[0].Result != 0) { object[] objArray = new object[1]; objArray[0] = name; throw ExceptionHelper.GetExceptionFromErrorCode(Convert.ToInt32(nameTranslateResult[0].Result), string.Format(CultureInfo.CurrentCulture, StringResources.TranslateNameError, objArray), null); } else { string str = nameTranslateResult[0].Name; return(str); } }
public static bool IsValidPath(string path, ADPathFormat format) { if (!string.IsNullOrEmpty(path)) { ADPathFormat aDPathFormat = format; switch (aDPathFormat) { case ADPathFormat.X500: { return(X500Path.IsValidPath(path)); } case ADPathFormat.Canonical: { return(CanonicalPath.IsValidPath(path)); } } return(false); } else { return(true); } }
public ADDriveInfo(string name, ProviderInfo provider, string root, string rootWithAbsoluteToken, string description, PSCredential credential) : base(name, provider, rootWithAbsoluteToken, description, credential) { this._formatType = ADProviderDefaults.PathFormat; this._authType = ADProviderDefaults.AuthType; this._isGC = ADProviderDefaults.IsGC; this._ssl = ADProviderDefaults.Ssl; this._encryption = ADProviderDefaults.Encryption; this._signing = ADProviderDefaults.Signing; this._rootWithoutAbsolutePathToken = root; }
public ADDriveInfo() : base(null) { this._formatType = ADProviderDefaults.PathFormat; this._authType = ADProviderDefaults.AuthType; this._isGC = ADProviderDefaults.IsGC; this._ssl = ADProviderDefaults.Ssl; this._encryption = ADProviderDefaults.Encryption; this._signing = ADProviderDefaults.Signing; }
internal string TranslateName(string name, ADPathFormat formatOffered, ADPathFormat formatDesired) { this.Init(); TranslateNameRequest translateNameRequest = new TranslateNameRequest(); translateNameRequest.Names = new string[1]; translateNameRequest.Names[0] = name; translateNameRequest.FormatOffered = this.GetNameFormat(formatOffered); translateNameRequest.FormatDesired = this.GetNameFormat(formatDesired); TranslateNameResponse translateNameResponse = this._acctMgmt.TranslateName(this._sessionHandle, translateNameRequest); ActiveDirectoryNameTranslateResult[] nameTranslateResult = translateNameResponse.NameTranslateResult; if (nameTranslateResult[0].Result != 0) { object[] objArray = new object[1]; objArray[0] = name; throw ExceptionHelper.GetExceptionFromErrorCode(Convert.ToInt32 (nameTranslateResult[0].Result), string.Format(CultureInfo.CurrentCulture, StringResources.TranslateNameError, objArray), null); } else { string str = nameTranslateResult[0].Name; return str; } }
private ActiveDirectoryNameFormat GetNameFormat(ADPathFormat pathFormat) { ActiveDirectoryNameFormat activeDirectoryNameFormat = ActiveDirectoryNameFormat.DistinguishedName; ADPathFormat aDPathFormat = pathFormat; switch (aDPathFormat) { case ADPathFormat.X500: { activeDirectoryNameFormat = ActiveDirectoryNameFormat.DistinguishedName; break; } case ADPathFormat.Canonical: { activeDirectoryNameFormat = ActiveDirectoryNameFormat.CanonicalName; break; } } return activeDirectoryNameFormat; }
private ADObject GetValidatedADObject(ADSessionInfo sessionInfo, string path, Collection<string> propertiesToRetrieve, ADPathFormat formatType) { ADObject aDObject; this.Trace(DebugLogLevel.Verbose, "Entering GetValidatedADObject"); this.Trace(DebugLogLevel.Info, string.Format("GetValidatedADObject: path = {0}", path)); ADObjectSearcher aDObjectSearcher = this.BuildADObjectSearcher(sessionInfo); using (aDObjectSearcher) { aDObjectSearcher.SearchRoot = path; aDObjectSearcher.Scope = ADSearchScope.Base; if (propertiesToRetrieve != null) { aDObjectSearcher.Properties.AddRange(propertiesToRetrieve); } if (formatType == ADPathFormat.Canonical) { aDObjectSearcher.Properties.Add("canonicalName"); } aDObject = aDObjectSearcher.FindOne(); } this.Trace(DebugLogLevel.Verbose, "Leaving GetValidatedADObject"); return aDObject; }
public static string MakePath(string parent, string child, ADPathFormat format) { if (!string.IsNullOrEmpty(parent) || !string.IsNullOrEmpty(child)) { if (!string.IsNullOrEmpty(parent)) { if (!string.IsNullOrEmpty(child)) { ADPathFormat aDPathFormat = format; switch (aDPathFormat) { case ADPathFormat.X500: { return X500Path.MakePath(parent, child); } case ADPathFormat.Canonical: { return CanonicalPath.MakePath(parent, child); } } return null; } else { return parent; } } else { return child; } } else { return ""; } }
public static bool IsChildPath(string path, string parentPath, bool includeSelf, ADPathFormat format) { if (string.IsNullOrEmpty(path) || string.IsNullOrEmpty(parentPath)) { if (!includeSelf) { return false; } else { return path == parentPath; } } else { ADPathFormat aDPathFormat = format; switch (aDPathFormat) { case ADPathFormat.X500: { return X500Path.IsChildPath(path, parentPath, includeSelf); } case ADPathFormat.Canonical: { return CanonicalPath.IsChildPath(path, parentPath, includeSelf); } } return false; } }
public static bool IsValidPath(string path, ADPathFormat format) { if (!string.IsNullOrEmpty(path)) { ADPathFormat aDPathFormat = format; switch (aDPathFormat) { case ADPathFormat.X500: { return X500Path.IsValidPath(path); } case ADPathFormat.Canonical: { return CanonicalPath.IsValidPath(path); } } return false; } else { return true; } }