예제 #1
0
 /**
  * To delete a record list
  * @param $api ServiceBase The API class of the request, used in cases where the API changes how the fields are pulled from the args array.
  * @param $args array The arguments array passed in from the API containing the module
  * @return bool Did the delete succeed
  */
 public function recordListDelete($api, $args)
 {
     $seed = BeanFactory::newBean($args['module']);
     if (!$seed->ACLAccess('access')) {
         throw new SugarApiExceptionNotAuthorized();
     }
     if (empty($args['record_list_id'])) {
         throw new SugarApiExceptionMissingParameter();
     }
     if (!$api->user->isAdmin()) {
         $recordList = RecordListFactory::getRecordList($args['record_list_id']);
         if ($recordList['assigned_user_id'] != $api->user->id) {
             throw new SugarApiExceptionNotAuthorized();
         }
     }
     $ret = RecordListFactory::deleteRecordList($args['record_list_id']);
     return true;
 }