mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-07-23 15:55:49 +00:00
Revert "Añadido funcionalidad de admin activa cliente"
This reverts commit 82ab379934
.
This commit is contained in:
parent
82ab379934
commit
38ef66723a
3 changed files with 2 additions and 53 deletions
|
@ -89,20 +89,4 @@ public class AdministratorController {
|
|||
this.clientService.saveClient(client);
|
||||
return "redirect:/administrators/clients";
|
||||
}
|
||||
|
||||
@GetMapping(value = "/administrators/clients/{username}/activate")
|
||||
public String activateClient(@PathVariable("username") final String username, final ModelMap model) {
|
||||
|
||||
Client client = this.clientService.findByUsername(username);
|
||||
model.put("client", client);
|
||||
return "clients/clientActivate";
|
||||
}
|
||||
@PostMapping(value = "/administrators/clients/{username}/activate")
|
||||
public String activateClientForm(@PathVariable("username") final String username, final ModelMap model, final HttpServletRequest request) {
|
||||
|
||||
Client client = this.clientService.findByUsername(username);
|
||||
client.getUsuar().setEnabled(true);
|
||||
this.clientService.saveClient(client);
|
||||
return "redirect:/administrators/clients";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,25 +0,0 @@
|
|||
<%@ page session="false" trimDirectiveWhitespaces="true"%>
|
||||
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
|
||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
|
||||
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
|
||||
<%@ taglib prefix="cheapy" tagdir="/WEB-INF/tags"%>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
|
||||
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
|
||||
|
||||
<cheapy:layout pageName="client">
|
||||
|
||||
<jsp:body>
|
||||
<h2 class="text-center" style="font-family: 'Lobster'; font-size: 30px; color: rgb(0, 64, 128); padding:30px"><em>¿Está seguro de que quiere activar esta cuenta?</em></h2>
|
||||
|
||||
<form:form modelAttribute="client" class="form-horizontal">
|
||||
|
||||
<div class="btns-edit2">
|
||||
<button type="submit" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon glyphicon-trash" aria-hidden="true" style="padding: 5px"> </span>
|
||||
Activar</button>
|
||||
</div>
|
||||
</form:form>
|
||||
|
||||
</jsp:body>
|
||||
|
||||
</cheapy:layout>
|
|
@ -69,26 +69,16 @@
|
|||
Borrar cliente</button>
|
||||
</div>
|
||||
</sec:authorize>
|
||||
<sec:authorize access="hasAnyAuthority('admin')">
|
||||
<sec:authorize access="hasAnyAuthority('admin')">
|
||||
<sec:authentication var="principal" property="principal" />
|
||||
<div class="btns-edit">
|
||||
<c:if test="${ client.usuar.enabled eq true}">
|
||||
|
||||
<spring:url value="/administrators/clients/{username}/disable" var="deactivateUrl">
|
||||
<spring:param name="username" value="${client.usuar.username}"/>
|
||||
</spring:url>
|
||||
<button type="button" role="link" onclick="window.location='${fn:escapeXml(deactivateUrl)}'" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon glyphicon-trash" aria-hidden="true" style="padding: 5px"> </span>
|
||||
Desactivar cliente</button>
|
||||
</c:if>
|
||||
|
||||
<c:if test="${ client.usuar.enabled eq false}">
|
||||
<spring:url value="/administrators/clients/{username}/activate" var="activateUrl">
|
||||
<spring:param name="username" value="${client.usuar.username}"/>
|
||||
</spring:url>
|
||||
<button type="button" role="link" onclick="window.location='${fn:escapeXml(activateUrl)}'" style="font-family: 'Lobster'; font-size: 20px;">
|
||||
<span class="glyphicon glyphicon glyphicon-trash" aria-hidden="true" style="padding: 5px"> </span>
|
||||
Activar cliente</button>
|
||||
</c:if>
|
||||
</div>
|
||||
</sec:authorize>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue