Example #1
0
function gotClearanceForTagChain($const_base)
{
    global $rackCode, $expl_tags, $impl_tags;
    $context = array_merge($const_base, $expl_tags, $impl_tags);
    $context = reindexById($context, 'tag', TRUE);
    foreach ($rackCode as $sentence) {
        switch ($sentence['type']) {
            case 'SYNT_GRANT':
                if (eval_expression($sentence['condition'], $context)) {
                    return $sentence['decision'];
                }
                break;
            case 'SYNT_ADJUSTMENT':
                if (eval_expression($sentence['condition'], $context) and processAdjustmentSentence($sentence['modlist'], $expl_tags)) {
                    $impl_tags = getImplicitTags($expl_tags);
                    // recalculate
                    $context = array_merge($const_base, $expl_tags, $impl_tags);
                    $context = reindexById($context, 'tag', TRUE);
                }
                break;
            default:
                throw new RackTablesError("Can't process sentence of unknown type '{$sentence['type']}'", RackTablesError::INTERNAL);
        }
    }
    return FALSE;
}
Example #2
0
function getCactiGraphsForObject($object_id)
{
    $result = usePreparedSelectBlade('SELECT graph_id, caption FROM CactiGraph WHERE object_id = ? ORDER BY graph_id', array($object_id));
    return reindexById($result->fetchAll(PDO::FETCH_ASSOC), 'graph_id');
}
function getUnlinkedNodePingChecks($object_id)
{
    $result = usePreparedSelectBlade('SELECT id, label, target, type ' . 'FROM NodePingCheck ' . 'WHERE id NOT IN (SELECT check_id FROM NodePingLink WHERE object_id = ?) ' . 'ORDER BY label, target, type', array($object_id));
    return reindexById($result->fetchAll(PDO::FETCH_ASSOC));
}