mirror of
https://github.com/st-tu-dresden-praktikum/swt23w23
synced 2024-07-19 21:04:36 +02:00
Let admin edit all fields of customer
This commit is contained in:
parent
b944d04b5d
commit
2515c17de5
|
@ -116,9 +116,10 @@ public class UserController {
|
|||
|
||||
@PostMapping("/customers/edit/{id}")
|
||||
@PreAuthorize("hasRole('ADMIN')")
|
||||
public String updateCustomer(@PathVariable("id") User user, @RequestParam String username, @RequestParam String address) {
|
||||
public String updateCustomer(@PathVariable("id") User user, @RequestParam String fullName, @RequestParam String username, @RequestParam String address) {
|
||||
user.setUsername(username);
|
||||
user.setAddress(address);
|
||||
user.setFullName(fullName);
|
||||
userManagement.save(user);
|
||||
return "redirect:/customers";
|
||||
}
|
||||
|
|
|
@ -12,9 +12,13 @@
|
|||
<label class="form-label" for="username">Nutzername</label>
|
||||
<input class="form-control" type="text" name="username" th:value="${customer.username}"/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="fullName">Name</label>
|
||||
<input class="form-control" type="fullName" name="fullName" th:value="${customer.fullName}"/>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label class="form-label" for="address">Adresse</label>
|
||||
<input class="form-control" type="text" name="address" th:value="${customer.address}"/>
|
||||
<textarea class="form-control" name="address" th:text="${customer.address}" rows="3" required></textarea>
|
||||
</div>
|
||||
<button class="btn btn-primary" type="submit">Speichern</button>
|
||||
</form>
|
||||
|
|
Loading…
Reference in a new issue