/
policy_deny.h
43 lines (32 loc) · 1.19 KB
/
policy_deny.h
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
40
41
42
43
#ifndef SRC_POLICY_POLICY_DENY_H_
#define SRC_POLICY_POLICY_DENY_H_
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
#include "v8.h"
#include <map>
#include <string>
namespace node {
namespace policy {
#define FILESYSTEM_PERMISSIONS(V) \
V(FileSystem, "fs", PermissionsRoot) \
V(FileSystemIn, "fs.in", FileSystem) \
V(FileSystemOut, "fs.out", FileSystem)
#define PERMISSIONS(V) \
FILESYSTEM_PERMISSIONS(V) \
#define V(name, _, __) k##name,
enum class Permission {
kPermissionsRoot = -1,
PERMISSIONS(V)
kPermissionsCount
};
#undef V
class PolicyDeny {
public:
virtual v8::Maybe<bool> Apply(const std::string& deny) = 0;
virtual bool Deny(Permission scope,
const std::vector<std::string>& params) = 0;
virtual bool is_granted(Permission perm, const std::string& param = "") = 0;
};
} // namespace policy
} // namespace node
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
#endif // SRC_POLICY_POLICY_DENY_H_