MCPcopy Create free account
hub / github.com/Icinga/icinga2 / GetObject

Method GetObject

lib/base/scriptutils.cpp:463–486  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

461}
462
463ConfigObject::Ptr ScriptUtils::GetObject(const Value& vtype, const String& name)
464{
465 Type::Ptr ptype;
466
467 if (vtype.IsObjectType<Type>())
468 ptype = vtype;
469 else
470 ptype = Type::GetByName(vtype);
471
472 auto *ctype = dynamic_cast<ConfigType *>(ptype.get());
473
474 if (!ctype)
475 return nullptr;
476
477 auto cfgObj = ctype->GetObject(name);
478 if (cfgObj) {
479 auto* frame = ScriptFrame::GetCurrentFrame();
480 if (frame->PermChecker->CanAccessConfigObject(cfgObj)) {
481 return cfgObj;
482 }
483 }
484
485 return nullptr;
486}
487
488Array::Ptr ScriptUtils::GetObjects(const Type::Ptr& type)
489{

Callers

nothing calls this directly

Calls 2

getMethod · 0.45
CanAccessConfigObjectMethod · 0.45

Tested by

no test coverage detected