#pragma once #include #include class CUserManager2 { public: static CUserManager2& getInstance(); 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 getRoles(); std::vector 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(); ~CUserManager2(); };