Commit b851bc66 authored by miferreiro's avatar miferreiro

Improved control of adding a pet to a person's pet list

- It has been added to restart the form after deleting a row.
- Permits have been introduced to the rest resources
parent fc8d2406
...@@ -40,6 +40,21 @@ ...@@ -40,6 +40,21 @@
<role-name>ADMIN</role-name> <role-name>ADMIN</role-name>
</auth-constraint> </auth-constraint>
</security-constraint> </security-constraint>
<security-constraint>
<web-resource-collection>
<web-resource-name>Admin Area</web-resource-name>
<url-pattern>/rest/pets/*</url-pattern>
<http-method>PUT</http-method>
<http-method>DELETE</http-method>
<http-method>GET</http-method>
<http-method>POST</http-method>
<http-method>OPTIONS</http-method>
</web-resource-collection>
<auth-constraint>
<role-name>ADMIN</role-name>
</auth-constraint>
</security-constraint>
<!-- Security roles referenced by this web application --> <!-- Security roles referenced by this web application -->
<security-role> <security-role>
......
...@@ -101,6 +101,7 @@ var PeopleView = (function() { ...@@ -101,6 +101,7 @@ var PeopleView = (function() {
dao.deletePerson(id, dao.deletePerson(id,
function() { function() {
$('tr#person-' + id).remove(); $('tr#person-' + id).remove();
self.resetForm();
}, },
showErrorMessage showErrorMessage
); );
......
...@@ -92,6 +92,9 @@ var PetsView = (function() { ...@@ -92,6 +92,9 @@ var PetsView = (function() {
function(pet) { function(pet) {
appendToTable(pet); appendToTable(pet);
self.resetForm(); self.resetForm();
if(pet.idOwner != id) {
$('tr#pet-' + pet.id).remove();
}
}, },
showErrorMessage, showErrorMessage,
self.enableForm self.enableForm
...@@ -150,6 +153,7 @@ var PetsView = (function() { ...@@ -150,6 +153,7 @@ var PetsView = (function() {
dao.deletePet(id, dao.deletePet(id,
function() { function() {
$('tr#pet-' + id).remove(); $('tr#pet-' + id).remove();
self.resetForm();
}, },
showErrorMessage showErrorMessage
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment