Changeset 14515

Show
Ignore:
Timestamp:
01/19/08 22:19:20 (11 months ago)
Author:
rambo
Message:

forward port r14514

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/midcom/fi.hut.loginbroker/callbacks/prototypes.php

    r14380 r14515  
    11<?php 
    22/** 
    3  * @package fi.hut.loginbroker 
     3 * @package ${module} 
    44 * @author The Midgard Project, http://www.midgard-project.org 
    55 * @copyright The Midgard Project, http://www.midgard-project.org 
     
    1414 *  
    1515 * @package fi.hut.loginbroker 
    16  * @todo rollback system 
    1716 */ 
    1817class fi_hut_loginbroker_callbacks_prototype_base extends midcom_baseclasses_components_purecode 
     
    4847 
    4948    /** 
    50      * Helper to generate random string of printable characters of given length 
    51      * 
    52      * @param int $length how many characters? 
     49     * Helper to generate random string of printable characters of given lenght 
     50     * 
     51     * @param int $lenght how many characters? 
    5352     * @return string of random garbage 
    5453     */ 
     
    164163     * and password to $request_data['password'] 
    165164     * 
    166      * @param string $username username to use 
    167      * @param array &$request_data request data, see key 'property_map' for more interesting info 
    168      * @param int $iteration this is 1 if this is the first callback to be called, callbacks must check this and not create new person if this is > 1 
     165     * @param $username username to use 
     166     * @param $request_data request data, see key 'property_map' for more interesting info 
     167     * @param $iteration this is 1 if this is the first callback to be called, callbacks must check this and not create new person if this is > 1 
    169168     * @return boolean indicating success (do note that processing of callbacks etc is aborted if someone returns failure) 
    170169     */ 
     
    195194     * 
    196195     * @see fi_hut_loginbroker_callbacks_prototype_create::create() 
    197      * @param string $username username to use 
    198      * @param array &$request_data request data, see key 'property_map' for more interesting info 
    199      * @param int $iteration this is 1 if this is the first callback to be called, callbacks must check this and not create new person if this is > 1 
     196     * @param $username username to use 
     197     * @param $request_data request data, see key 'property_map' for more interesting info 
     198     * @param $iteration this is 1 if this is the first callback to be called, callbacks must check this and not create new person if this is > 1 
    200199     */ 
    201200    function update($username, &$request_data, $iteration) 
  • trunk/midcom/fi.hut.loginbroker/config/config.inc

    r14178 r14515  
    1010( 
    1111    'fi_hut_loginbroker_callbacks_createperson', 
     12    'fi_hut_loginbroker_callbacks_affiliations', 
    1213), 
    1314'fi_hut_loginbroker_callbacks_createperson_config' => array /* callback configurations should be namespaced like this */ 
     
    2728( 
    2829    'fi_hut_loginbroker_callbacks_updateperson', 
     30    'fi_hut_loginbroker_callbacks_affiliations', 
     31), 
     32'fi_hut_loginbroker_callbacks_affiliations_config' => array 
     33( 
     34    'enable' => false, /* quick way to enable/disable the plugin without messing with other configs */ 
     35    'header' => 'HTTP_SHIB_EPA', /* <AttributeRule Name="urn:mace:dir:attribute-def:eduPersonAffiliation" Header="SHIB_EPA" Alias="affiliation"> */ 
     36    'delimiter' => ';', /* how the header delimits the affiliation values */ 
     37    'map' => array /* keys are affiliations values local group guids */ 
     38    ( 
     39    ), 
    2940), 
    3041'username_header' => 'REMOTE_USER', /* which $_SERVER key has the username */ 
  • trunk/midcom/fi.hut.loginbroker/exec/test_callback.php

    r14178 r14515  
    11<?php 
    22$_MIDCOM->auth->require_admin_user(); 
     3$classes = array 
     4( 
     5    'fi_hut_loginbroker_callbacks_createperson', 
     6    'fi_hut_loginbroker_callbacks_updateperson', 
     7    'fi_hut_loginbroker_callbacks_resetpasswd', 
     8    'fi_hut_loginbroker_callbacks_affiliations', 
     9); 
    310 
    4 $ret = fi_hut_loginbroker_viewer::load_callback_class('fi_hut_loginbroker_callbacks_createperson'); 
    5 $ret = fi_hut_loginbroker_viewer::load_callback_class('fi_hut_loginbroker_callbacks_updateperson'); 
    6 $ret = fi_hut_loginbroker_viewer::load_callback_class('fi_hut_loginbroker_callbacks_resetpasswd'); 
     11echo "Loading callback classes...<br>\n"; 
     12foreach ($classes as $class) 
     13
     14    $ret = fi_hut_loginbroker_viewer::load_callback_class($class); 
     15    echo "&nbsp;&nbsp;&nbsp;<tt>{$class}</tt>: {$ret}<br>\n"; 
     16
     17echo "Done.<br>\n"; 
     18 
    719 
    820/* 
     
    5264*/ 
    5365 
     66/* 
     67$_SERVER['HTTP_SHIB_EPA'] = 'member;trustee'; 
     68//$_SERVER['HTTP_SHIB_EPA'] = 'trustee'; 
     69//$_SERVER['HTTP_SHIB_EPA'] = 'member'; 
     70//$_SERVER['HTTP_SHIB_EPA'] = ''; 
     71$data = array(); 
     72$handler = new fi_hut_loginbroker_callbacks_affiliations(); 
     73$data['property_map'] = array 
     74( 
     75    'firstname' => 'luidefname', 
     76    'lastname' => 'luidelname', 
     77    'email' => 'test@nemein.com', 
     78); 
     79$ret = $handler->update('luide', $data, 1); 
     80echo "\$handler->update('luide', \$data, 1) returned: {$ret}, local_data:<pre>\n"; 
     81print_r($handler->_local_data); 
     82echo "</pre>\n"; 
     83$ret = $handler->rollback(); 
     84echo "\$handler->rollback() returned: {$ret}<br/>"; 
     85*/ 
     86/* 
     87$ret = $handler->create('luide', $data, 1); 
     88echo "\$handler->create('luide', \$data, 1) returned: {$ret}, local_data:<pre>\n"; 
     89print_r($handler->_local_data); 
     90echo "</pre>\n"; 
     91$ret = $handler->rollback(); 
     92echo "\$handler->rollback() returned: {$ret}<br/>"; 
     93*/ 
     94 
    5495?> 
  • trunk/midcom/fi.hut.loginbroker/handler/index.php

    r14385 r14515  
    4242        $this->_request_data['person'] =& $this->_person; 
    4343        $this->_request_data['l10n'] =& $this->_l10n; 
     44        // The native plugins can use just $this->_config but if external plugins need to read our config they can use this property 
     45        $this->_request_data['loginbroker_config'] =& $this->_config; 
    4446    } 
    4547 
     
    176178             * AND 'create_user_callbacks' is not empty 
    177179             */ 
    178             $this->_do_callbacks($callbacks, 'create', &$data); 
     180            $this->_do_callbacks($callbacks, 'create', $data); 
    179181            if (!empty($data['password'])) 
    180182            { 
     
    265267        if (!$this->_check_user($data)) 
    266268        { 
    267             // The method should generate its own errors but here we trap anyway 
     269            // The method should generate it's own errors but here we trap anyway 
    268270            return false; 
    269271        } 
     
    271273        if (!$this->_login_user($data)) 
    272274        { 
    273             // The method should generate its own errors but here we trap anyway 
     275            // The method should generate it's own errors but here we trap anyway 
    274276            return false; 
    275277        } 
     
    346348                continue; 
    347349            } 
    348             // Do we want to do something after successful store ?? 
     350            // Do we want to do something after succesfull store ?? 
    349351        } 
    350352    } 
     
    352354    /** 
    353355     * This function does the output. 
    354      * 
    355      * @param mixed $handler_id The ID of the handler. 
    356      * @param mixed &$data The local request data. 
     356     *   
    357357     */ 
    358358    function _show_index($handler_id, &$data)