mirror of
				https://git.code.sf.net/p/seeddms/code
				synced 2025-10-31 13:18:06 +00:00 
			
		
		
		
	add new method getDocumentContentAttributes()
This commit is contained in:
		
							parent
							
								
									b068c385e7
								
							
						
					
					
						commit
						8484d38974
					
				|  | @ -1343,16 +1343,39 @@ class RestapiController { /* {{{ */ | |||
|         $document = $dms->getDocument($args['id']); | ||||
|         if($document) { | ||||
|             if ($document->getAccessMode($userobj) >= M_READ) { | ||||
|                 $recs = array(); | ||||
|                 $attributes = $document->getAttributes(); | ||||
|                 foreach($attributes as $attribute) { | ||||
|                     $recs[] = array( | ||||
|                         'id'=>(int)$attribute->getId(), | ||||
|                         'value'=>$attribute->getValue(), | ||||
|                         'name'=>$attribute->getAttributeDefinition()->getName(), | ||||
|                     ); | ||||
|                 $attributes = $this->__getAttributesData($document); | ||||
|                 return $response->withJson(array('success'=>true, 'message'=>'', 'data'=>$attributes), 200); | ||||
|             } else { | ||||
|                 return $response->withJson(array('success'=>false, 'message'=>'No access', 'data'=>''), 403); | ||||
|             } | ||||
|         } else { | ||||
|             if($document === null) | ||||
|                 $status=404; | ||||
|             else | ||||
|                 $status=500; | ||||
|             return $response->withJson(array('success'=>false, 'message'=>'No document', 'data'=>''), $status); | ||||
|         } | ||||
|     } /* }}} */ | ||||
| 
 | ||||
|     function getDocumentContentAttributes($request, $response, $args) { /* {{{ */ | ||||
|         $dms = $this->container->dms; | ||||
|         $userobj = $this->container->userobj; | ||||
| 
 | ||||
|         $document = $dms->getDocument($args['id']); | ||||
|         if($document) { | ||||
|             if ($document->getAccessMode($userobj) >= M_READ) { | ||||
| 
 | ||||
|                 $version = $document->getContentByVersion($args['version']); | ||||
|                 if($version) { | ||||
|                     if($version->getAccessMode($userobj) >= M_READ) { | ||||
|                         $attributes = $this->__getAttributesData($version); | ||||
|                         return $response->withJson(array('success'=>true, 'message'=>'', 'data'=>$attributes), 200); | ||||
|                     } else { | ||||
|                         return $response->withJson(array('success'=>false, 'message'=>'No access on version', 'data'=>''), 403); | ||||
|                     } | ||||
|                 } else { | ||||
|                     return $response->withJson(array('success'=>false, 'message'=>'No version', 'data'=>''), 404); | ||||
|                 } | ||||
|                 return $response->withJson(array('success'=>true, 'message'=>'', 'data'=>$recs), 200); | ||||
|             } else { | ||||
|                 return $response->withJson(array('success'=>false, 'message'=>'No access', 'data'=>''), 403); | ||||
|             } | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Uwe Steinmann
						Uwe Steinmann