Expose Zone#all_parents via API

This commit is contained in:
Alexander A. Klimov 2018-08-08 14:15:01 +02:00
parent 7bcbd9b497
commit ea5614f7df
3 changed files with 15 additions and 0 deletions

View File

@ -20,6 +20,7 @@
#include "remote/zone.hpp"
#include "remote/zone-ti.cpp"
#include "remote/jsonrpcconnection.hpp"
#include "base/array.hpp"
#include "base/objectlock.hpp"
#include "base/logger.hpp"
@ -94,6 +95,16 @@ std::vector<Zone::Ptr> Zone::GetAllParentsRaw() const
return m_AllParents;
}
Array::Ptr Zone::GetAllParents() const
{
auto result (new Array);
for (auto& parent : m_AllParents)
result->Add(parent->GetName());
return result;
}
bool Zone::CanAccessObject(const ConfigObject::Ptr& object)
{
Zone::Ptr object_zone;

View File

@ -41,6 +41,7 @@ public:
Zone::Ptr GetParent() const;
std::set<Endpoint::Ptr> GetEndpoints() const;
std::vector<Zone::Ptr> GetAllParentsRaw() const;
Array::Ptr GetAllParents() const override;
bool CanAccessObject(const ConfigObject::Ptr& object);
bool IsChildOf(const Zone::Ptr& zone);

View File

@ -34,6 +34,9 @@ class Zone : ConfigObject
[config] array(name(Endpoint)) endpoints (EndpointsRaw);
[config] bool global;
[no_user_modify, no_storage] array(Value) all_parents {
get;
};
};
}