12 std::wstring m_domain;
13 std::wstring m_username;
19 void LookupAccount(
const std::wstring& account_name,
const std::wstring& computer_name = L
"");
21 void LookupSid(PSID psid,
const std::wstring& computer_name = L
"");
27 void SetFQN(
const std::wstring& fqn);
29 std::wstring
GetFQN()
const {
return m_domain.empty() ? m_username : m_domain + L
"\\" + m_username; }
31 const std::wstring&
GetUserName()
const {
return m_username; }
33 const std::wstring&
GetDomain()
const {
return m_domain; }
35 void GetUserRights(std::vector<std::wstring>& rights,
const std::wstring& computername = L
"")
const;
37 void AddUserRight(
const std::wstring& right,
const std::wstring& computername = L
"");
39 void RemoveUserRight(
const std::wstring& right,
const std::wstring& computername = L
"");
45 static void Create(USER_INFO_1 ui,
const std::wstring& servername = L
"");
47 static void Create(
const std::wstring& username,
const std::wstring& password,
const std::wstring& servername = L
"");
49 static void Delete(
const std::wstring& username,
const std::wstring& servername = L
"");
51 static bool Exists(
const std::wstring& username,
const std::wstring& servername = L
"");
53 static std::wstring
Translate(
const std::wstring& name, EXTENDED_NAME_FORMAT from, EXTENDED_NAME_FORMAT to);
static void Create(USER_INFO_1 ui, const std::wstring &servername=L"")
create a local user
Definition: Account.cpp:148
void AddUserRight(const std::wstring &right, const std::wstring &computername=L"")
add a user right
Definition: Account.cpp:102
const std::wstring & GetDomain() const
computer or domain name
Definition: Account.h:33
void SetSID(const Sid &sid)
set SID
Definition: Account.h:25
A user account.
Definition: Account.h:8
const Sid & GetSid() const
SID.
Definition: Account.h:23
void GetUserRights(std::vector< std::wstring > &rights, const std::wstring &computername=L"") const
get a list of user rights
Definition: Account.cpp:67
Account & operator=(const Account &)
copy
Definition: Account.cpp:13
void LookupSid(PSID psid, const std::wstring &computer_name=L"")
lookup an account by SID
Definition: Account.cpp:213
const std::wstring & GetUserName() const
username
Definition: Account.h:31
static std::wstring GetCurrentUserName()
get the current username
Definition: Account.cpp:126
Account()
Definition: Account.cpp:8
Security identifier: a data structure of variable length that identifies user, group, and computer accounts.
Definition: Sid.h:8
void LookupAccount(const std::wstring &account_name, const std::wstring &computer_name=L"")
lookup an account by name
Definition: Account.cpp:39
static bool Exists(const std::wstring &username, const std::wstring &servername=L"")
check whether the user exists
Definition: Account.cpp:172
std::wstring GetFQN() const
fully qualified name
Definition: Account.h:29
void SetFQN(const std::wstring &fqn)
set FQN (username, domain\username or username@domain)
Definition: Account.cpp:21
static void Delete(const std::wstring &username, const std::wstring &servername=L"")
delete a local user
Definition: Account.cpp:166
void RemoveUserRight(const std::wstring &right, const std::wstring &computername=L"")
revoke a user right
Definition: Account.cpp:114
static std::wstring Translate(const std::wstring &name, EXTENDED_NAME_FORMAT from, EXTENDED_NAME_FORMAT to)
converts a directory service object name from one format to another
Definition: Account.cpp:192