## Apache Zeta Components Manual :: File Source for ldap_options.php

## Source for file ldap_options.php

Documentation is available at ldap_options.php

1. <?php
2. /**
3. * File containing the ezcAuthenticationLdapOptions class.
4. *
5. * Licensed to the Apache Software Foundation (ASF) under one
6. * or more contributor license agreements. See the NOTICE file
7. * distributed with this work for additional information
8. * regarding copyright ownership. The ASF licenses this file
9. * to you under the Apache License, Version 2.0 (the
10. * "License"); you may not use this file except in compliance
11. * with the License. You may obtain a copy of the License at
12. *
13. * http://www.apache.org/licenses/LICENSE-2.0
14. *
15. * Unless required by applicable law or agreed to in writing,
16. * software distributed under the License is distributed on an
17. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18. * KIND, either express or implied. See the License for the
19. * specific language governing permissions and limitations
20. * under the License.
21. *
22. * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
23. * @filesource
24. * @package Authentication
25. * @version //autogen//
26. */
28. /**
29. * Class containing the options for ldap authentication filter.
30. *
31. * Example of use:
32. * <code>
33. * // create an options object
34. * $options = new ezcAuthenticationLdapOptions();
35. * $options->protocol = ezcAuthenticationLdapFilter::PROTOCOL_TLS;
36. *
37. * // use the options object when creating a new LDAP filter
38. * $ldap = new ezcAuthenticationLdapInfo( 'localhost', 'uid=%id%', 'dc=example,dc=com', 389 );
39. * $filter = new ezcAuthenticationLdapFilter( $ldap, $options );
40. *
41. * // alternatively, you can set the options to an existing filter
42. * $filter = new ezcAuthenticationLdapFilter( $ldap );
43. * $filter->setOptions( $options );
44. * </code>
45. *
46. * @property int $protocol
47. * How to connect to the LDAP server:
48. * - ezcAuthenticationLdapFilter::PROTOCOL_PLAIN - plain connection
49. * - ezcAuthenticationLdapFilter::PROTOCOL_TLS - TLS connection
50. *
51. * @package Authentication
52. * @version //autogen//
53. */
54. class ezcAuthenticationLdapOptions extends ezcAuthenticationFilterOptions
55. {
56. /**
57. * Constructs an object with the specified values.
58. *
59. * @throws ezcBasePropertyNotFoundException
60. * if $options contains a property not defined
61. * @throws ezcBaseValueException
62. * if $options contains a property with a value not allowed
63. * @param array(string=>mixed) $options Options for this class
64. */
65. public function __construct ( array $options = array() )
66. {
67. $this->protocol = ezcAuthenticationLdapFilter ::PROTOCOL_PLAIN;
69. parent:: __construct ( $options );
70. }
72. /**
73. * Sets the option $name to $value.
74. *
75. * @throws ezcBasePropertyNotFoundException
76. * if the property $name is not defined
77. * @throws ezcBaseValueException
78. * if $value is not correct for the property $name
79. * @param string $name The name of the property to set
80. * @param mixed $value The new value of the property
81. * @ignore
82. */
83. public function __set( $name, $value )
84. {
85. switch ( $name )
86. {
87. case 'protocol':
88. $allowedValues = array(
89. ezcAuthenticationLdapFilter ::PROTOCOL_PLAIN,
90. ezcAuthenticationLdapFilter ::PROTOCOL_TLS
91. );
92. if ( ! in_array ( $value, $allowedValues, true ) )
93. {
94. throw new ezcBaseValueException ( $name, $value, implode ( ', ', $allowedValues ) );
95. }
96. $this-> properties [$name] = $value;
97. break;
99. default:
100. parent::__set( $name, $value );
101. }
102. }
103. }
104. ?>

Documentation generated by phpDocumentor 1.4.3