Index: sandbox/2.4.1-3/prototype/rest/user/UsersResource.php
===================================================================
--- sandbox/2.4.1-3/prototype/rest/user/UsersResource.php	(revision 6395)
+++ sandbox/2.4.1-3/prototype/rest/user/UsersResource.php	(revision 6429)
@@ -43,168 +43,167 @@
 		    }
 		    else{
-			//lança warning no log do Expresso
-			trigger_error("Invalid field (".$_GET['field'].") in the query.", E_USER_WARNING);
-
-			//formata os atributos LDAP do conceito 'user'
-			$attributes = implode(', ', $map); 
-
-			//Configura o erro na hypermedia
+				//lança warning no log do Expresso
+				trigger_error("Invalid field (".$_GET['field'].") in the query.", E_USER_WARNING);
+
+				//formata os atributos LDAP do conceito 'user'
+				$attributes = implode(', ', $map); 
+
+				//Configura o erro na hypermedia
+				$error = new Error();
+				$error->setCode(Response::NOTFOUND);
+				$error->setTitle('UserLDAP not found');
+				$error->setDescription("Invalid field (".$_GET['field'].") in the query. Use of these: ".$attributes);
+
+				$c->setError($error);
+				$h->setCollection($c);
+
+				//retorna a hypermedia
+				$response->code = Response::NOTFOUND;
+				$response->body = $h->getHypermedia($request->accept[10][0]);
+				return $response;
+		    }
+	    }
+	    else{
+		    //Executa a consulta dos primeiros 20 usuarios do LDAP
+		    $users = Controller::find(array('concept' => 'user','service'=>'OpenLDAP'), false, array('filter' => array('=', 'phpgwAccountType', 'u'),'limit'=>20));
+	    }
+
+	    //Se nao foi encontrado usuarios na consulta
+	    if($users===false){
 			$error = new Error();
 			$error->setCode(Response::NOTFOUND);
 			$error->setTitle('UserLDAP not found');
-			$error->setDescription("Invalid field (".$_GET['field'].") in the query. Use of these: ".$attributes);
+			$error->setDescription('Users not found.');
 
 			$c->setError($error);
 			$h->setCollection($c);
 
-			//retorna a hypermedia
 			$response->code = Response::NOTFOUND;
 			$response->body = $h->getHypermedia($request->accept[10][0]);
 			return $response;
-		    }
-	    }
-	    else{
-		    //Executa a consulta dos primeiros 20 usuarios do LDAP
-		    $users = Controller::find(array('concept' => 'user','service'=>'OpenLDAP'), false, array('filter' => array('=', 'phpgwAccountType', 'u'),'limit'=>20));
-	    }
-
-	    //Se nao foi encontrado usuarios na consulta
-	    if($users===false){
-		$error = new Error();
-		$error->setCode(Response::NOTFOUND);
-		$error->setTitle('UserLDAP not found');
-		$error->setDescription('Users not found.');
-
-		$c->setError($error);
+	    }
+
+		foreach($users as $value){
+			$d = new Data();
+			$i = new Item($request->resources, 'UsersResource', $value['uid']);
+
+			$d->setName('name');
+			$d->setValue($value['name']);
+			$d->setPrompt('Nome do Usuario');
+			$d->setDataType('string');
+			$d->setMaxLength('100');
+			$d->setMinLength(null);
+			$d->setRequired(true);
+
+			$i->addData($d);
+
+			$d = new Data();
+			$d->setName('email');
+			$d->setValue($value['mail']);
+			$d->setPrompt('Email do Usuario');
+			$d->setDataType('string');
+			$d->setMaxLength('100');
+			$d->setMinLength(null);
+			$d->setRequired(true);
+
+			$i->addData($d);
+
+			$d = new Data();
+			$d->setName('telephoneNumber');
+			$d->setValue($value['telephoneNumber']);
+			$d->setPrompt('Telefone do Usuario');
+			$d->setDataType('string');
+			$d->setMaxLength('100');
+			$d->setMinLength(null);
+			$d->setRequired(true);
+
+			$i->addData($d);
+
+			$l = new Link();
+
+			$l->setHref('');
+			$l->setRel('delete');
+			$l->setAlt('Remover');
+			$l->setPrompt('Remover');
+			$l->setRender('link');
+
+			$i->addLink($l);
+
+			$l = new Link();
+			$l->setHref('');
+			$l->setRel('put');
+			$l->setAlt('Atualizar');
+			$l->setPrompt('Atualizar');
+			$l->setRender('link');
+
+			$i->addLink($l);
+
+			$l = new Link();
+			$l->setHref('/userldap/'.$value['uid']);
+			$l->setRel('get');
+			$l->setAlt('Buscar');
+			$l->setPrompt('Buscar');
+			$l->setRender('link');
+
+			$i->addLink($l);
+			$c->addItem($i);
+	    }
+
+		$t = new Template();
+		$d = new Data();
+
+		$d->setName('name');
+		$d->setValue(null);
+		$d->setPrompt('Nome do Usuario');
+		$d->setDataType('string');
+		$d->setMaxLength(100);
+		$d->setMinLength(null);
+		$d->setRequired(true);
+
+		$t->addData($d);
+
+		$d = new Data();
+		$d->setName('email');
+		$d->setValue(null);
+		$d->setPrompt('Email do Usuario');
+		$d->setDataType('string');
+		$d->setMaxLength(100);
+		$d->setMinLength(null);
+		$d->setRequired(true);
+
+		$t->addData($d);
+
+		$d = new Data();
+		$d->setName('telefone');
+		$d->setValue(null);
+		$d->setPrompt('Telefone do Usuario');
+		$d->setDataType('string');
+		$d->setMaxLength(100);
+		$d->setMinLength(null);
+		$d->setRequired(true);
+
+		$t->addData($d);
+
+		$c->setTemplate($t);
+
+		$d = new Data();
+		$d->setName('Usuario LDAP');
+		$d->setValue(null);
+		$d->setPrompt('Usuario do LDAP');
+		$d->setDataType(null);
+		$d->setMaxLength(null);
+		$d->setMinLength(null);
+		$d->setRequired(null);
+
+		$c->addData($d);
+
+	    $queries = new Querie();    
+		$queries->setHref($c->href);
+	    $queries->setData('field','',true);
+	    $queries->setData('value','',true);
+	    $c->addQueries($queries);
+
+
 		$h->setCollection($c);
-
-		$response->code = Response::NOTFOUND;
-		$response->body = $h->getHypermedia($request->accept[10][0]);
-		return $response;
-	    }
-
-            foreach($users as $value){
-		$d = new Data();
-                $i = new Item($request->resources, 'UsersResource', $value['uid']);
-
-		$d->setName('name');
-                $d->setValue($value['name']);
-                $d->setPrompt('Nome do Usuário');
-                $d->setDataType('string');
-                $d->setMaxLength('100');
-                $d->setMinLength(null);
-                $d->setRequired(true);
-
-                $i->addData($d);
-
-		$d = new Data();
-                $d->setName('email');
-                $d->setValue($value['mail']);
-                $d->setPrompt('Email do Usuário');
-                $d->setDataType('string');
-                $d->setMaxLength('100');
-                $d->setMinLength(null);
-                $d->setRequired(true);
-
-                $i->addData($d);
-
-		$d = new Data();
-                $d->setName('telephoneNumber');
-                $d->setValue($value['telephoneNumber']);
-                $d->setPrompt('Telefone do Usuário');
-                $d->setDataType('string');
-                $d->setMaxLength('100');
-                $d->setMinLength(null);
-                $d->setRequired(true);
-
-                $i->addData($d);
-
-                $l = new Link();
-
-                $l->setHref('');
-                $l->setRel('delete');
-                $l->setAlt('Remover');
-                $l->setPrompt('Remover');
-                $l->setRender('link');
-
-                $i->addLink($l);
-
-                $l = new Link();
-                $l->setHref('');
-                $l->setRel('put');
-                $l->setAlt('Atualizar');
-                $l->setPrompt('Atualizar');
-                $l->setRender('link');
-
-                $i->addLink($l);
-
-                $l = new Link();
-                $l->setHref('/userldap/'.$value['uid']);
-                $l->setRel('get');
-                $l->setAlt('Buscar');
-                $l->setPrompt('Buscar');
-                $l->setRender('link');
-
-                $i->addLink($l);
-                $c->addItem($i);
-	    }
-
-            $t = new Template();
-            $d = new Data();
-
-            $d->setName('name');
-            $d->setValue(null);
-            $d->setPrompt('Nome do Usuário');
-            $d->setDataType('string');
-            $d->setMaxLength(100);
-            $d->setMinLength(null);
-            $d->setRequired(true);
-
-            $t->addData($d);
-
-            $d = new Data();
-            $d->setName('email');
-            $d->setValue(null);
-            $d->setPrompt('Email do Usuário');
-            $d->setDataType('string');
-            $d->setMaxLength(100);
-            $d->setMinLength(null);
-            $d->setRequired(true);
-
-            $t->addData($d);
-
-            $d = new Data();
-            $d->setName('telefone');
-            $d->setValue(null);
-            $d->setPrompt('Telefone do Usuário');
-            $d->setDataType('string');
-            $d->setMaxLength(100);
-            $d->setMinLength(null);
-            $d->setRequired(true);
-
-            $t->addData($d);
-
-            $c->setTemplate($t);
-
-            $d = new Data();
-            $d->setName('Usuário LDAP');
-            $d->setValue(null);
-            $d->setPrompt('Usuário do LDAP');
-            $d->setDataType(null);
-            $d->setMaxLength(null);
-            $d->setMinLength(null);
-            $d->setRequired(null);
-
-            $c->setData($d);
-
-	    $queries = array();
-	    $queries[0] = new Querie();
-            $queries[0]->setHref($c->href);
-	    $queries[0]->setData('field','',true);
-	    $queries[0]->setData('value','',true);
-	    $c->setQueries($queries);
-
-
-            $h->setCollection($c);
 
 	}catch (Exception $ex){
Index: sandbox/2.4.1-3/prototype/rest/user/UserResource.php
===================================================================
--- sandbox/2.4.1-3/prototype/rest/user/UserResource.php	(revision 6360)
+++ sandbox/2.4.1-3/prototype/rest/user/UserResource.php	(revision 6429)
@@ -160,5 +160,5 @@
             $d->setRequired(null);
 
-            $c->setData($d);
+            $c->addData($d);
 
             $h->setCollection($c);
