1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:28:11 +00:00

ConfigServer: Add methods to list groups and keys

Applications that make use of LibConfig anyway have now a way of listing
the groups and keys without resorting to using Core::ConfigFile
directly.
This commit is contained in:
faxe1008 2021-11-16 20:04:41 +01:00 committed by Andreas Kling
parent 2266b4acdb
commit 116d89eec6
3 changed files with 21 additions and 0 deletions

View file

@ -135,6 +135,22 @@ void ClientConnection::sync_dirty_domains_to_disk()
}
}
Messages::ConfigServer::ListConfigKeysResponse ClientConnection::list_config_keys(String const& domain, String const& group)
{
if (!validate_access(domain, group, ""))
return Vector<String> {};
auto& config = ensure_domain_config(domain);
return { config.keys(group) };
}
Messages::ConfigServer::ListConfigGroupsResponse ClientConnection::list_config_groups(String const& domain)
{
if (!validate_access(domain, "", ""))
return Vector<String> {};
auto& config = ensure_domain_config(domain);
return { config.groups() };
}
Messages::ConfigServer::ReadStringValueResponse ClientConnection::read_string_value(String const& domain, String const& group, String const& key)
{
if (!validate_access(domain, group, key))