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.  */
  27.  
  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. {
  55.     /**
  56.      * Constructs an object with the specified values.
  57.      *
  58.      * @throws ezcBasePropertyNotFoundException
  59.      *          if $options contains a property not defined
  60.      * @throws ezcBaseValueException
  61.      *          if $options contains a property with a value not allowed
  62.      * @param array(string=>mixed) $options Options for this class
  63.      */
  64.     public function __constructarray $options array() )
  65.     {
  66.         $this->protocol ezcAuthenticationLdapFilter::PROTOCOL_PLAIN;
  67.  
  68.         parent::__construct$options );
  69.     }
  70.  
  71.     /**
  72.      * Sets the option $name to $value.
  73.      *
  74.      * @throws ezcBasePropertyNotFoundException
  75.      *          if the property $name is not defined
  76.      * @throws ezcBaseValueException
  77.      *          if $value is not correct for the property $name
  78.      * @param string $name The name of the property to set
  79.      * @param mixed $value The new value of the property
  80.      * @ignore
  81.      */
  82.     public function __set$name$value )
  83.     {
  84.         switch $name )
  85.         {
  86.             case 'protocol':
  87.                 $allowedValues array(
  88.                                         ezcAuthenticationLdapFilter::PROTOCOL_PLAIN,
  89.                                         ezcAuthenticationLdapFilter::PROTOCOL_TLS
  90.                                       );
  91.                 if !in_array$value$allowedValuestrue ) )
  92.                 {
  93.                     throw new ezcBaseValueException$name$valueimplode', '$allowedValues ) );
  94.                 }
  95.                 $this->properties[$name$value;
  96.                 break;
  97.  
  98.             default:
  99.                 parent::__set$name$value );
  100.         }
  101.     }
  102. }
  103. ?>
Documentation generated by phpDocumentor 1.4.3