2013-06-03 17:02:08 +02:00
|
|
|
<?php
|
2013-06-07 13:29:11 +02:00
|
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
2013-06-28 16:47:30 +02:00
|
|
|
/**
|
2013-07-15 12:26:10 +02:00
|
|
|
* This file is part of Icinga 2 Web.
|
2013-09-04 18:27:16 +02:00
|
|
|
*
|
2013-07-15 12:26:10 +02:00
|
|
|
* Icinga 2 Web - Head for multiple monitoring backends.
|
2013-06-28 16:47:30 +02:00
|
|
|
* Copyright (C) 2013 Icinga Development Team
|
2013-09-04 18:27:16 +02:00
|
|
|
*
|
2013-06-28 16:47:30 +02:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2013-09-04 18:27:16 +02:00
|
|
|
*
|
2013-06-28 16:47:30 +02:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2013-09-04 18:27:16 +02:00
|
|
|
*
|
2013-06-28 16:47:30 +02:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2013-09-04 18:27:16 +02:00
|
|
|
*
|
2013-06-28 16:47:30 +02:00
|
|
|
* @copyright 2013 Icinga Development Team <info@icinga.org>
|
2013-07-15 12:26:10 +02:00
|
|
|
* @license http://www.gnu.org/licenses/gpl-2.0.txt GPL, version 2
|
|
|
|
* @author Icinga Development Team <info@icinga.org>
|
2013-06-28 16:47:30 +02:00
|
|
|
*/
|
2013-06-07 13:29:11 +02:00
|
|
|
// {{{ICINGA_LICENSE_HEADER}}}
|
2013-06-03 17:02:08 +02:00
|
|
|
|
|
|
|
namespace Icinga\Protocol\Ldap;
|
2013-06-07 13:29:11 +02:00
|
|
|
|
2013-06-03 17:02:08 +02:00
|
|
|
/**
|
|
|
|
* This class represents an LDAP node object
|
|
|
|
*
|
|
|
|
* @copyright Copyright (c) 2013 Icinga-Web Team <info@icinga.org>
|
|
|
|
* @author Icinga-Web Team <info@icinga.org>
|
2013-06-07 13:29:11 +02:00
|
|
|
* @package Icinga\Protocol\Ldap
|
2013-06-03 17:02:08 +02:00
|
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
|
|
|
|
*/
|
|
|
|
class Node extends Root
|
|
|
|
{
|
2013-06-07 13:29:11 +02:00
|
|
|
/**
|
|
|
|
* @var Connection
|
|
|
|
*/
|
2013-06-03 17:02:08 +02:00
|
|
|
protected $connection;
|
2013-06-07 13:29:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @var
|
|
|
|
*/
|
2013-06-03 17:02:08 +02:00
|
|
|
protected $rdn;
|
2013-06-07 13:29:11 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @var Root
|
|
|
|
*/
|
2013-06-03 17:02:08 +02:00
|
|
|
protected $parent;
|
|
|
|
|
2013-06-07 13:29:11 +02:00
|
|
|
/**
|
|
|
|
* @param Root $parent
|
|
|
|
*/
|
2013-06-03 17:02:08 +02:00
|
|
|
protected function __construct(Root $parent)
|
|
|
|
{
|
|
|
|
$this->connection = $parent->getConnection();
|
|
|
|
$this->parent = $parent;
|
|
|
|
}
|
|
|
|
|
2013-06-07 13:29:11 +02:00
|
|
|
/**
|
|
|
|
* @param $parent
|
|
|
|
* @param $rdn
|
|
|
|
* @param array $props
|
|
|
|
* @return Node
|
|
|
|
*/
|
2013-06-03 17:02:08 +02:00
|
|
|
public static function createWithRDN($parent, $rdn, $props = array())
|
|
|
|
{
|
|
|
|
$node = new Node($parent);
|
|
|
|
$node->rdn = $rdn;
|
|
|
|
$node->props = $props;
|
|
|
|
return $node;
|
|
|
|
}
|
|
|
|
|
2013-06-07 13:29:11 +02:00
|
|
|
/**
|
|
|
|
* @return mixed
|
|
|
|
*/
|
2013-06-03 17:02:08 +02:00
|
|
|
public function getRDN()
|
|
|
|
{
|
|
|
|
return $this->rdn;
|
|
|
|
}
|
|
|
|
|
2013-06-07 13:29:11 +02:00
|
|
|
/**
|
|
|
|
* @return mixed|string
|
|
|
|
*/
|
2013-06-03 17:02:08 +02:00
|
|
|
public function getDN()
|
|
|
|
{
|
|
|
|
return $this->parent->getDN() . '.' . $this->getRDN();
|
|
|
|
}
|
|
|
|
}
|