Changeset 14515
- Timestamp:
- 01/19/08 22:19:20 (11 months ago)
- Files:
-
- trunk/midcom/fi.hut.loginbroker/callbacks/prototypes.php (modified) (5 diffs)
- trunk/midcom/fi.hut.loginbroker/config/config.inc (modified) (2 diffs)
- trunk/midcom/fi.hut.loginbroker/exec/test_callback.php (modified) (2 diffs)
- trunk/midcom/fi.hut.loginbroker/handler/index.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/midcom/fi.hut.loginbroker/callbacks/prototypes.php
r14380 r14515 1 1 <?php 2 2 /** 3 * @package fi.hut.loginbroker3 * @package ${module} 4 4 * @author The Midgard Project, http://www.midgard-project.org 5 5 * @copyright The Midgard Project, http://www.midgard-project.org … … 14 14 * 15 15 * @package fi.hut.loginbroker 16 * @todo rollback system17 16 */ 18 17 class fi_hut_loginbroker_callbacks_prototype_base extends midcom_baseclasses_components_purecode … … 48 47 49 48 /** 50 * Helper to generate random string of printable characters of given leng th51 * 52 * @param int $leng thhow many characters?49 * Helper to generate random string of printable characters of given lenght 50 * 51 * @param int $lenght how many characters? 53 52 * @return string of random garbage 54 53 */ … … 164 163 * and password to $request_data['password'] 165 164 * 166 * @param string$username username to use167 * @param array &$request_data request data, see key 'property_map' for more interesting info168 * @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 > 1165 * @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 169 168 * @return boolean indicating success (do note that processing of callbacks etc is aborted if someone returns failure) 170 169 */ … … 195 194 * 196 195 * @see fi_hut_loginbroker_callbacks_prototype_create::create() 197 * @param string$username username to use198 * @param array &$request_data request data, see key 'property_map' for more interesting info199 * @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 > 1196 * @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 200 199 */ 201 200 function update($username, &$request_data, $iteration) trunk/midcom/fi.hut.loginbroker/config/config.inc
r14178 r14515 10 10 ( 11 11 'fi_hut_loginbroker_callbacks_createperson', 12 'fi_hut_loginbroker_callbacks_affiliations', 12 13 ), 13 14 'fi_hut_loginbroker_callbacks_createperson_config' => array /* callback configurations should be namespaced like this */ … … 27 28 ( 28 29 '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 ), 29 40 ), 30 41 'username_header' => 'REMOTE_USER', /* which $_SERVER key has the username */ trunk/midcom/fi.hut.loginbroker/exec/test_callback.php
r14178 r14515 1 1 <?php 2 2 $_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 ); 3 10 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'); 11 echo "Loading callback classes...<br>\n"; 12 foreach ($classes as $class) 13 { 14 $ret = fi_hut_loginbroker_viewer::load_callback_class($class); 15 echo " <tt>{$class}</tt>: {$ret}<br>\n"; 16 } 17 echo "Done.<br>\n"; 18 7 19 8 20 /* … … 52 64 */ 53 65 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); 80 echo "\$handler->update('luide', \$data, 1) returned: {$ret}, local_data:<pre>\n"; 81 print_r($handler->_local_data); 82 echo "</pre>\n"; 83 $ret = $handler->rollback(); 84 echo "\$handler->rollback() returned: {$ret}<br/>"; 85 */ 86 /* 87 $ret = $handler->create('luide', $data, 1); 88 echo "\$handler->create('luide', \$data, 1) returned: {$ret}, local_data:<pre>\n"; 89 print_r($handler->_local_data); 90 echo "</pre>\n"; 91 $ret = $handler->rollback(); 92 echo "\$handler->rollback() returned: {$ret}<br/>"; 93 */ 94 54 95 ?> trunk/midcom/fi.hut.loginbroker/handler/index.php
r14385 r14515 42 42 $this->_request_data['person'] =& $this->_person; 43 43 $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; 44 46 } 45 47 … … 176 178 * AND 'create_user_callbacks' is not empty 177 179 */ 178 $this->_do_callbacks($callbacks, 'create', &$data);180 $this->_do_callbacks($callbacks, 'create', $data); 179 181 if (!empty($data['password'])) 180 182 { … … 265 267 if (!$this->_check_user($data)) 266 268 { 267 // The method should generate it s own errors but here we trap anyway269 // The method should generate it's own errors but here we trap anyway 268 270 return false; 269 271 } … … 271 273 if (!$this->_login_user($data)) 272 274 { 273 // The method should generate it s own errors but here we trap anyway275 // The method should generate it's own errors but here we trap anyway 274 276 return false; 275 277 } … … 346 348 continue; 347 349 } 348 // Do we want to do something after succes sful store ??350 // Do we want to do something after succesfull store ?? 349 351 } 350 352 } … … 352 354 /** 353 355 * 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 * 357 357 */ 358 358 function _show_index($handler_id, &$data)
