Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

permission: move PrintTree into unnamed namespace #48874

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 29 additions & 28 deletions src/permission/fs_permission.cc
Original file line number Diff line number Diff line change
Expand Up @@ -67,52 +67,53 @@ bool is_tree_granted(node::permission::FSPermission::RadixTree* granted_tree,
return granted_tree->Lookup(param, true);
}

} // namespace

namespace node {

namespace permission {

void PrintTree(const FSPermission::RadixTree::Node* node, size_t spaces = 0) {
void PrintTree(const node::permission::FSPermission::RadixTree::Node* node,
size_t spaces = 0) {
std::string whitespace(spaces, ' ');

if (node == nullptr) {
return;
}
if (node->wildcard_child != nullptr) {
per_process::Debug(DebugCategory::PERMISSION_MODEL,
"%s Wildcard: %s\n",
whitespace,
node->prefix);
node::per_process::Debug(node::DebugCategory::PERMISSION_MODEL,
"%s Wildcard: %s\n",
whitespace,
node->prefix);
} else {
per_process::Debug(DebugCategory::PERMISSION_MODEL,
"%s Prefix: %s\n",
whitespace,
node->prefix);
node::per_process::Debug(node::DebugCategory::PERMISSION_MODEL,
"%s Prefix: %s\n",
whitespace,
node->prefix);
if (node->children.size()) {
size_t child = 0;
for (const auto& pair : node->children) {
++child;
per_process::Debug(DebugCategory::PERMISSION_MODEL,
"%s Child(%s): %s\n",
whitespace,
child,
std::string(1, pair.first));
node::per_process::Debug(node::DebugCategory::PERMISSION_MODEL,
"%s Child(%s): %s\n",
whitespace,
child,
std::string(1, pair.first));
PrintTree(pair.second, spaces + 2);
}
per_process::Debug(DebugCategory::PERMISSION_MODEL,
"%s End of tree - child(%s)\n",
whitespace,
child);
node::per_process::Debug(node::DebugCategory::PERMISSION_MODEL,
"%s End of tree - child(%s)\n",
whitespace,
child);
} else {
per_process::Debug(DebugCategory::PERMISSION_MODEL,
"%s End of tree: %s\n",
whitespace,
node->prefix);
node::per_process::Debug(node::DebugCategory::PERMISSION_MODEL,
"%s End of tree: %s\n",
whitespace,
node->prefix);
}
}
}

} // namespace

namespace node {

namespace permission {

// allow = '*'
// allow = '/tmp/,/home/example.js'
void FSPermission::Apply(const std::string& allow, PermissionScope scope) {
Expand Down