Apache Zeta Components Manual :: File Source for group_options.php

Source for file group_options.php

Documentation is available at group_options.php

  1. <?php
  2. /**
  3.  * File containing the ezcAuthenticationGroupOptions 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 group authentication filter.
  30.  *
  31.  * Example of use:
  32.  * <code>
  33.  * $options = new ezcAuthenticationGroupOptions();
  34.  * $options->mode = ezcAuthenticationGroupFilter::MODE_AND;
  35.  * $options->mode->multipleCredentials = false;
  36.  *
  37.  * // $filter1 and $filter2 are authentication filters which need all to succeed
  38.  * // in order for the group to succeed
  39.  * $filter = new ezcAuthenticationGroupFilter( array( $filter1, $filter2 ), $options );
  40.  * </code>
  41.  *
  42.  * @property int $mode 
  43.  *            The way of grouping the authentication filters. Possible values:
  44.  *             - ezcAuthenticationGroupFilter::MODE_OR (default): at least one
  45.  *               filter in the group needs to succeed in order for the group to
  46.  *               succeed.
  47.  *             - ezcAuthenticationGroupFilter::MODE_AND: all filters in the group
  48.  *               need to succeed in order for the group to succeed.
  49.  * @property bool $multipleCredentials 
  50.  *            If enabled (set to true), each filter must be added to the group
  51.  *            along with a credentials object (through the constructor or with
  52.  *            addFilter()). By default is false (the credentials from the
  53.  *            ezcAuthentication object are used for all filters in the group).
  54.  *
  55.  * @package Authentication
  56.  * @version //autogen//
  57.  */
  58. {
  59.     /**
  60.      * Constructs an object with the specified values.
  61.      *
  62.      * @throws ezcBasePropertyNotFoundException
  63.      *          if $options contains a property not defined
  64.      * @throws ezcBaseValueException
  65.      *          if $options contains a property with a value not allowed
  66.      * @param array(string=>mixed) $options Options for this class
  67.      */
  68.     public function __constructarray $options array() )
  69.     {
  70.         $this->mode ezcAuthenticationGroupFilter::MODE_OR;
  71.         $this->multipleCredentials false;
  72.  
  73.         parent::__construct$options );
  74.     }
  75.  
  76.     /**
  77.      * Sets the option $name to $value.
  78.      *
  79.      * @throws ezcBasePropertyNotFoundException
  80.      *          if the property $name is not defined
  81.      * @throws ezcBaseValueException
  82.      *          if $value is not correct for the property $name
  83.      * @param string $name The name of the property to set
  84.      * @param mixed $value The new value of the property
  85.      * @ignore
  86.      */
  87.     public function __set$name$value )
  88.     {
  89.         switch $name )
  90.         {
  91.             case 'mode':
  92.                 $modes array(
  93.                                 ezcAuthenticationGroupFilter::MODE_OR,
  94.                                 ezcAuthenticationGroupFilter::MODE_AND
  95.                               );
  96.                 if !in_array$value$modestrue ) )
  97.                 {
  98.                     throw new ezcBaseValueException$name$valueimplode', '$modes ) );
  99.                 }
  100.                 $this->properties[$name$value;
  101.                 break;
  102.  
  103.             case 'multipleCredentials':
  104.                 if !is_bool$value ) )
  105.                 {
  106.                     throw new ezcBaseValueException$name$value'bool' );
  107.                 }
  108.                 $this->properties[$name$value;
  109.                 break;
  110.  
  111.             default:
  112.                 parent::__set$name$value );
  113.         }
  114.     }
  115. }
  116. ?>
Documentation generated by phpDocumentor 1.4.3