Added the zend framework 2 library, the path is specified in line no.26 in zend_modul...
[openemr.git] / interface / modules / zend_modules / library / Zend / Ldap / Node / RootDse.php
blob94a55d2140295cf7d82da340541f1809eafaf06c
1 <?php
2 /**
3 * Zend Framework (http://framework.zend.com/)
5 * @link http://github.com/zendframework/zf2 for the canonical source repository
6 * @copyright Copyright (c) 2005-2013 Zend Technologies USA Inc. (http://www.zend.com)
7 * @license http://framework.zend.com/license/new-bsd New BSD License
8 */
10 namespace Zend\Ldap\Node;
12 use Zend\Ldap;
14 /**
15 * Zend\Ldap\Node\RootDse provides a simple data-container for the RootDse node.
17 class RootDse extends AbstractNode
19 const SERVER_TYPE_GENERIC = 1;
20 const SERVER_TYPE_OPENLDAP = 2;
21 const SERVER_TYPE_ACTIVEDIRECTORY = 3;
22 const SERVER_TYPE_EDIRECTORY = 4;
24 /**
25 * Factory method to create the RootDse.
27 * @param \Zend\Ldap\Ldap $ldap
28 * @return RootDse
30 public static function create(Ldap\Ldap $ldap)
32 $dn = Ldap\Dn::fromString('');
33 $data = $ldap->getEntry($dn, array('*', '+'), true);
34 if (isset($data['domainfunctionality'])) {
35 return new RootDse\ActiveDirectory($dn, $data);
36 } elseif (isset($data['dsaname'])) {
37 return new RootDse\eDirectory($dn, $data);
38 } elseif (isset($data['structuralobjectclass'])
39 && $data['structuralobjectclass'][0] === 'OpenLDAProotDSE'
40 ) {
41 return new RootDse\OpenLdap($dn, $data);
44 return new static($dn, $data);
47 /**
48 * Constructor.
50 * Constructor is protected to enforce the use of factory methods.
52 * @param \Zend\Ldap\Dn $dn
53 * @param array $data
55 protected function __construct(Ldap\Dn $dn, array $data)
57 parent::__construct($dn, $data, true);
60 /**
61 * Gets the namingContexts.
63 * @return array
65 public function getNamingContexts()
67 return $this->getAttribute('namingContexts', null);
70 /**
71 * Gets the subschemaSubentry.
73 * @return string|null
75 public function getSubschemaSubentry()
77 return $this->getAttribute('subschemaSubentry', 0);
80 /**
81 * Determines if the version is supported
83 * @param string|int|array $versions version(s) to check
84 * @return bool
86 public function supportsVersion($versions)
88 return $this->attributeHasValue('supportedLDAPVersion', $versions);
91 /**
92 * Determines if the sasl mechanism is supported
94 * @param string|array $mechlist SASL mechanisms to check
95 * @return bool
97 public function supportsSaslMechanism($mechlist)
99 return $this->attributeHasValue('supportedSASLMechanisms', $mechlist);
103 * Gets the server type
105 * @return int
107 public function getServerType()
109 return self::SERVER_TYPE_GENERIC;
113 * Returns the schema DN
115 * @return \Zend\Ldap\Dn
117 public function getSchemaDn()
119 $schemaDn = $this->getSubschemaSubentry();
120 return Ldap\Dn::fromString($schemaDn);