diff --git a/src/Coordination/KeeperStorage.cpp b/src/Coordination/KeeperStorage.cpp index 2a01d60f227..63272b14a4a 100644 --- a/src/Coordination/KeeperStorage.cpp +++ b/src/Coordination/KeeperStorage.cpp @@ -84,6 +84,34 @@ static bool checkACL(int32_t permission, const Coordination::ACLs & node_acls, c return false; } +static bool fixupACL( + const std::vector & request_acls, + const std::vector & current_ids, + std::vector & result_acls) +{ + if (request_acls.empty()) + return false; + + for (const auto & request_acl : request_acls) + { + if (request_acl.scheme == "world" && request_acl.id == "anyone") + { + result_acls.push_back(request_acl); + } + else if (request_acl.scheme == "auth") + { + for (const auto & current_id : current_ids) + { + Coordination::ACL new_acl = request_acl; + new_acl.scheme = current_id.scheme; + new_acl.id = current_id.id; + result_acls.push_back(new_acl); + } + } + } + return !result_acls.empty(); +} + static KeeperStorage::ResponsesForSessions processWatchesImpl(const String & path, KeeperStorage::Watches & watches, KeeperStorage::Watches & list_watches, Coordination::Event event_type) { KeeperStorage::ResponsesForSessions result; @@ -120,34 +148,6 @@ static KeeperStorage::ResponsesForSessions processWatchesImpl(const String & pat return result; } -static bool fixupACL( - const std::vector & request_acls, - const std::vector & current_ids, - std::vector & result_acls) -{ - if (request_acls.empty()) - return false; - - for (const auto & request_acl : request_acls) - { - if (request_acl.scheme == "world" && request_acl.id == "anyone") - { - result_acls.push_back(request_acl); - } - else if (request_acl.scheme == "auth") - { - for (const auto & current_id : current_ids) - { - Coordination::ACL new_acl = request_acl; - new_acl.scheme = current_id.scheme; - new_acl.id = current_id.id; - result_acls.push_back(new_acl); - } - } - } - return !result_acls.empty(); -} - KeeperStorage::KeeperStorage(int64_t tick_time_ms) : session_expiry_queue(tick_time_ms) {