[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 <?php 2 /*+*********************************************************************************** 3 * The contents of this file are subject to the vtiger CRM Public License Version 1.0 4 * ("License"); You may not use this file except in compliance with the License 5 * The Original Code is: vtiger CRM Open Source 6 * The Initial Developer of the Original Code is vtiger. 7 * Portions created by vtiger are Copyright (C) vtiger. 8 * All Rights Reserved. 9 *************************************************************************************/ 10 11 function vtws_retrieve($id, $user){ 12 13 global $log,$adb; 14 15 $webserviceObject = VtigerWebserviceObject::fromId($adb,$id); 16 $handlerPath = $webserviceObject->getHandlerPath(); 17 $handlerClass = $webserviceObject->getHandlerClass(); 18 19 require_once $handlerPath; 20 21 $handler = new $handlerClass($webserviceObject,$user,$adb,$log); 22 $meta = $handler->getMeta(); 23 $entityName = $meta->getObjectEntityName($id); 24 $types = vtws_listtypes(null, $user); 25 if(!in_array($entityName,$types['types'])){ 26 throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED,"Permission to perform the operation is denied"); 27 } 28 if($meta->hasReadAccess()!==true){ 29 throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED,"Permission to write is denied"); 30 } 31 32 if($entityName !== $webserviceObject->getEntityName()){ 33 throw new WebServiceException(WebServiceErrorCode::$INVALIDID,"Id specified is incorrect"); 34 } 35 36 if(!$meta->hasPermission(EntityMeta::$RETRIEVE,$id)){ 37 throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED,"Permission to read given object is denied"); 38 } 39 40 $idComponents = vtws_getIdComponents($id); 41 if(!$meta->exists($idComponents[1])){ 42 throw new WebServiceException(WebServiceErrorCode::$RECORDNOTFOUND,"Record you are trying to access is not found"); 43 } 44 45 $entity = $handler->retrieve($id); 46 VTWS_PreserveGlobal::flush(); 47 return $entity; 48 } 49 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |