mirror of
https://github.com/MichaelGrafnetter/DSInternals
synced 2025-02-17 03:16:51 +00:00
Resolved #18: GetAccountByUPN
This commit is contained in:
parent
6640562faf
commit
0406d0c024
@ -280,6 +280,12 @@ namespace DSInternals
|
||||
return Guid::Parse(stringGuid);
|
||||
}
|
||||
|
||||
Guid DrsConnection::ResolveGuid(String^ userPrincipalName)
|
||||
{
|
||||
auto stringGuid = this->ResolveName(userPrincipalName, DS_NAME_FORMAT::DS_USER_PRINCIPAL_NAME, DS_NAME_FORMAT::DS_UNIQUE_ID_NAME);
|
||||
return Guid::Parse(stringGuid);
|
||||
}
|
||||
|
||||
String^ DrsConnection::ResolveName(String^ name, DS_NAME_FORMAT formatOffered, DS_NAME_FORMAT formatDesired)
|
||||
{
|
||||
// We only want to resolve 1 name at a time:
|
||||
|
@ -49,6 +49,7 @@ namespace DSInternals
|
||||
String^ ResolveDistinguishedName(SecurityIdentifier^ objectSid);
|
||||
Guid ResolveGuid(NTAccount^ accountName);
|
||||
Guid ResolveGuid(SecurityIdentifier^ objectSid);
|
||||
Guid ResolveGuid(String^ userPrincipalName);
|
||||
protected:
|
||||
virtual bool ReleaseHandle() override;
|
||||
private:
|
||||
|
@ -129,6 +129,13 @@
|
||||
return this.GetAccount(objectGuid);
|
||||
}
|
||||
|
||||
public DSAccount GetAccountByUPN(string userPrincipalName)
|
||||
{
|
||||
// TODO: Redesign the GetAccount overloads, for GetAccountByUPN to follow the same convention.
|
||||
Guid objectGuid = this.drsConnection.ResolveGuid(userPrincipalName);
|
||||
return this.GetAccount(objectGuid);
|
||||
}
|
||||
|
||||
private DirectorySecretDecryptor SecretDecryptor
|
||||
{
|
||||
get
|
||||
|
Loading…
Reference in New Issue
Block a user