- Timestamp:
- Jan 29, 2007, 9:38:08 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/ws_core.inc.php
r1698 r1768 564 564 return new PwgError(WS_ERR_MISSING_PARAM, 'Missing parameters: '.implode(',',$missing_params)); 565 565 } 566 567 $result = call_user_func_array($callback, array($params, &$this) ); 566 $result = trigger_event('ws_invoke_allowed', true, $methodName, $params); 567 if ( strtolower( get_class($result) )!='pwgerror') 568 { 569 $result = call_user_func_array($callback, array($params, &$this) ); 570 } 568 571 return $result; 569 572 } -
trunk/include/ws_functions.inc.php
r1760 r1768 28 28 29 29 /** 30 * Event handler for method invocation security check. Should return a PwgError 31 * if the preconditions are not satifsied for method invocation. 32 */ 33 function ws_isInvokeAllowed($res, $methodName, $params) 34 { 35 global $conf, $calling_partner_id; 36 if ( !$conf['ws_access_control']) 37 { 38 return $res; // No controls are requested 39 } 40 $query = ' 41 SELECT * FROM '.WEB_SERVICES_ACCESS_TABLE." 42 WHERE `name` = '$calling_partner_id' 43 AND NOW() <= end; "; 44 $result = pwg_query($query); 45 $row = mysql_fetch_assoc($result); 46 if ( empty($row) ) 47 { 48 return new PwgError(403, 'Partner id does not exist'); 49 } 50 return $res; 51 } 52 53 /** 30 54 * ws_add_controls 31 55 * returns additionnal controls if requested -
trunk/include/ws_protocols/rest_handler.php
-
Property
svn:keywords
set to
Author Date Id Revision
r1698 r1768 5 5 // +-----------------------------------------------------------------------+ 6 6 // | branch : BSF (Best So Far) 7 // | file : $ URL: svn+ssh://rvelices@svn.gna.org/svn/phpwebgallery/trunk/action.php$8 // | last update : $Date : 2006-12-21 18:49:12 -0500 (Thu, 21 Dec 2006)$9 // | last modifier : $Author : rvelices$10 // | revision : $Rev : 1678$7 // | file : $Id$ 8 // | last update : $Date$ 9 // | last modifier : $Author$ 10 // | revision : $Rev$ 11 11 // +-----------------------------------------------------------------------+ 12 12 // | This program is free software; you can redistribute it and/or modify | … … 34 34 foreach ($param_array as $name => $value) 35 35 { 36 if ($name=='format' )37 continue; 36 if ($name=='format' or $name=='partner') 37 continue; // ignore - special keys 38 38 if ($name=='method') 39 39 { -
Property
svn:keywords
set to
-
trunk/ws.php
r1750 r1768 30 30 include_once(PHPWG_ROOT_PATH.'include/ws_core.inc.php'); 31 31 32 /** 33 * event handler that registers standard methods with the web service 34 */ 32 35 function ws_addDefaultMethods( $arr ) 33 36 { … … 107 110 } 108 111 109 add_event_handler('ws_add_methods', 'ws_addDefaultMethods' 112 add_event_handler('ws_add_methods', 'ws_addDefaultMethods'); 110 113 114 115 add_event_handler('ws_invoke_allowed', 'ws_isInvokeAllowed', EVENT_HANDLER_PRIORITY_NEUTRAL, 3); 116 117 $calling_partner_id = ''; 111 118 $requestFormat = null; 112 119 $responseFormat = null; 113 120 121 if ( isset($_GET['partner']) ) 122 { 123 $calling_partner_id = $_GET['partner']; 124 } 114 125 if ( isset($_GET['format']) ) 115 126 {
Note: See TracChangeset
for help on using the changeset viewer.