src/Common/Lsa/Account.h

Go to the documentation of this file.
00001 #pragma once
00002 
00003 namespace AppSecInc 
00004 {
00005     namespace LSA
00006     {
00008         class Account
00009         {
00010         private:
00011                         Sid m_sid;
00012             std::wstring m_domain;
00013             std::wstring m_username;
00014         public:
00015             Account();
00017             Account& operator=(const Account&);
00019             void LookupAccount(const std::wstring& account_name, const std::wstring& computer_name = L"");
00021                         void LookupSid(PSID psid, const std::wstring& computer_name = L"");
00023                         const Sid& GetSid() const { return m_sid; }
00025                         void SetSID(const Sid& sid) { m_sid = sid; }
00027                         void SetFQN(const std::wstring& fqn);
00029                         std::wstring GetFQN() const { return m_domain.empty() ? m_username : m_domain + L"\\" + m_username; }
00031             const std::wstring& GetUserName() const { return m_username; }
00033             const std::wstring& GetDomain() const { return m_domain; }
00035                         void GetUserRights(std::vector<std::wstring>& rights, const std::wstring& computername = L"") const;
00037             void AddUserRight(const std::wstring& right, const std::wstring& computername = L"");
00039             void RemoveUserRight(const std::wstring& right, const std::wstring& computername = L"");
00041             static std::wstring GetCurrentUserName();
00043             static std::wstring GetCurrentUserName(EXTENDED_NAME_FORMAT format);
00045             static void Create(USER_INFO_1 ui, const std::wstring& servername = L"");
00047             static void Create(const std::wstring& username, const std::wstring& password, const std::wstring& servername = L"");
00049             static void Delete(const std::wstring& username, const std::wstring& servername = L"");
00051             static bool Exists(const std::wstring& username, const std::wstring& servername = L"");
00053                         static std::wstring Translate(const std::wstring& name, EXTENDED_NAME_FORMAT from, EXTENDED_NAME_FORMAT to);
00054         };
00055     }
00056 }
00057 


© Application Security Inc. - All Rights Reserved http://msiext.codeplex.com