2013-06-03 11:02:08 -04:00
|
|
|
<?php
|
2026-03-26 12:46:27 -04:00
|
|
|
|
|
|
|
|
// SPDX-FileCopyrightText: 2018 Icinga GmbH <https://icinga.com>
|
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
2013-06-03 11:02:08 -04:00
|
|
|
|
|
|
|
|
namespace Icinga\Protocol\Ldap;
|
2013-06-07 07:29:11 -04:00
|
|
|
|
2013-06-03 11:02:08 -04:00
|
|
|
/**
|
|
|
|
|
* This class represents an LDAP node object
|
|
|
|
|
*
|
2017-01-12 06:28:40 -05:00
|
|
|
* @copyright Copyright (c) 2013 Icinga-Web Team <info@icinga.com>
|
|
|
|
|
* @author Icinga-Web Team <info@icinga.com>
|
2013-06-07 07:29:11 -04:00
|
|
|
* @package Icinga\Protocol\Ldap
|
2013-06-03 11:02:08 -04:00
|
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License
|
|
|
|
|
*/
|
|
|
|
|
class Node extends Root
|
|
|
|
|
{
|
2013-06-07 07:29:11 -04:00
|
|
|
/**
|
2015-06-24 03:05:29 -04:00
|
|
|
* @var LdapConnection
|
2013-06-07 07:29:11 -04:00
|
|
|
*/
|
2013-06-03 11:02:08 -04:00
|
|
|
protected $connection;
|
2013-06-07 07:29:11 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var
|
|
|
|
|
*/
|
2013-06-03 11:02:08 -04:00
|
|
|
protected $rdn;
|
2013-06-07 07:29:11 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @var Root
|
|
|
|
|
*/
|
2013-06-03 11:02:08 -04:00
|
|
|
protected $parent;
|
|
|
|
|
|
2013-06-07 07:29:11 -04:00
|
|
|
/**
|
|
|
|
|
* @param Root $parent
|
|
|
|
|
*/
|
2013-06-03 11:02:08 -04:00
|
|
|
protected function __construct(Root $parent)
|
|
|
|
|
{
|
|
|
|
|
$this->connection = $parent->getConnection();
|
|
|
|
|
$this->parent = $parent;
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-07 07:29:11 -04:00
|
|
|
/**
|
|
|
|
|
* @param $parent
|
|
|
|
|
* @param $rdn
|
|
|
|
|
* @param array $props
|
|
|
|
|
* @return Node
|
|
|
|
|
*/
|
2013-06-03 11:02:08 -04:00
|
|
|
public static function createWithRDN($parent, $rdn, $props = array())
|
|
|
|
|
{
|
|
|
|
|
$node = new Node($parent);
|
|
|
|
|
$node->rdn = $rdn;
|
|
|
|
|
$node->props = $props;
|
|
|
|
|
return $node;
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-07 07:29:11 -04:00
|
|
|
/**
|
|
|
|
|
* @return mixed
|
|
|
|
|
*/
|
2013-06-03 11:02:08 -04:00
|
|
|
public function getRDN()
|
|
|
|
|
{
|
|
|
|
|
return $this->rdn;
|
|
|
|
|
}
|
|
|
|
|
|
2013-06-07 07:29:11 -04:00
|
|
|
/**
|
|
|
|
|
* @return mixed|string
|
|
|
|
|
*/
|
2013-06-03 11:02:08 -04:00
|
|
|
public function getDN()
|
|
|
|
|
{
|
2014-02-14 09:38:52 -05:00
|
|
|
return $this->getRDN() . ',' . $this->parent->getDN();
|
2013-06-03 11:02:08 -04:00
|
|
|
}
|
|
|
|
|
}
|