| | |
| | | #pragma once |
| | | |
| | | #include <string> |
| | | #include <vector> |
| | | |
| | | class CUserManager2 |
| | | { |
| | | public: |
| | |
| | | CUserManager2(const CUserManager2&) = delete; |
| | | CUserManager2& operator=(const CUserManager2&) = delete; |
| | | |
| | | struct RoleInfo |
| | | { |
| | | std::wstring name; |
| | | int level = 0; |
| | | }; |
| | | |
| | | struct UserInfo |
| | | { |
| | | std::wstring userName; |
| | | std::wstring displayName; |
| | | std::wstring roleName; |
| | | int roleLevel = 0; |
| | | bool enabled = false; |
| | | }; |
| | | |
| | | public: |
| | | void init(const char* pszDir); |
| | | bool login(const char* pszAccount, const char* pszPwd); |
| | | bool isLoggedIn(); |
| | | std::string getCurrentUserName(); |
| | | bool IsAdminCurrent(); |
| | | std::vector<RoleInfo> getRoles(); |
| | | std::vector<UserInfo> getUsers(); |
| | | int addUser(const std::wstring& userName, const std::wstring& displayName, |
| | | const std::wstring& password, const std::wstring& roleName, bool enabled); |
| | | int updateUser(const std::wstring& userName, const std::wstring& displayName, |
| | | const std::wstring& password, const std::wstring& roleName, bool enabled); |
| | | int deleteUser(const std::wstring& userName); |
| | | int setUserEnabled(const std::wstring& userName, bool enabled); |
| | | int resetPassword(const std::wstring& userName, const std::wstring& password); |
| | | |
| | | private: |
| | | CUserManager2(); |