[ 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_delete($id,$user){ 12 global $log,$adb; 13 $webserviceObject = VtigerWebserviceObject::fromId($adb,$id); 14 $handlerPath = $webserviceObject->getHandlerPath(); 15 $handlerClass = $webserviceObject->getHandlerClass(); 16 17 require_once $handlerPath; 18 19 $handler = new $handlerClass($webserviceObject,$user,$adb,$log); 20 $meta = $handler->getMeta(); 21 $entityName = $meta->getObjectEntityName($id); 22 23 $types = vtws_listtypes(null, $user); 24 if(!in_array($entityName,$types['types'])){ 25 throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED,"Permission to perform the operation is denied"); 26 } 27 28 if($entityName !== $webserviceObject->getEntityName()){ 29 throw new WebServiceException(WebServiceErrorCode::$INVALIDID,"Id specified is incorrect"); 30 } 31 32 if(!$meta->hasPermission(EntityMeta::$DELETE,$id)){ 33 throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED,"Permission to read given object is denied"); 34 } 35 36 $idComponents = vtws_getIdComponents($id); 37 if(!$meta->exists($idComponents[1])){ 38 throw new WebServiceException(WebServiceErrorCode::$RECORDNOTFOUND,"Record you are trying to access is not found"); 39 } 40 41 if($meta->hasDeleteAccess()!==true){ 42 throw new WebServiceException(WebServiceErrorCode::$ACCESSDENIED,"Permission to delete is denied"); 43 } 44 $entity = $handler->delete($id); 45 VTWS_PreserveGlobal::flush(); 46 return $entity; 47 } 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 |