-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPrivilegeManager.h
More file actions
39 lines (29 loc) · 1.09 KB
/
Copy pathPrivilegeManager.h
File metadata and controls
39 lines (29 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#pragma once
#include "StlHelper.h"
#include <set>
NS_BEGIN
//#################################################################################################
class CPrivilegeManager final
{
public:
CPrivilegeManager(void) = default;
// Copy and move constructors
CPrivilegeManager(const CPrivilegeManager &src) = delete;
CPrivilegeManager(CPrivilegeManager &&src) = delete;
~CPrivilegeManager(void);
// Copy and move assignment operators
CPrivilegeManager &operator=(const CPrivilegeManager &src) = delete;
CPrivilegeManager &operator=(CPrivilegeManager &&src) = delete;
enum EGrantLevel : uint8_t
{
EGL_Thread = 0, // Grant the privilege to the current thread
EGL_Process // Grant the privilege to the current process
};
bool Grant(PCNSTR szPrivilege, const EGrantLevel eLevel = EGL_Thread);
bool Revoke(PCNSTR szPrivilege, const EGrantLevel eLevel = EGL_Thread);
void RevokeAll(void);
static bool IsEnabled(PCNSTR szPrivilege, const EGrantLevel eLevel = EGL_Thread);
private:
std::set<std::pair<CStr, EGrantLevel>> m_setPrivileges;
};
NS_END