1

Add createLecture for orga only

Co-Authored-By: andibuls <andibuls@users.noreply.github.com>
Co-Authored-By: tomvahl <tomvahl@users.noreply.github.com>
Co-Authored-By: Lukas Ettel <lukasettel@users.noreply.github.com>
This commit is contained in:
XXNitram
2020-03-17 17:07:30 +01:00
parent e412c051f7
commit 179062eed9
3 changed files with 21 additions and 1 deletions

View File

@ -57,13 +57,19 @@ public class Gruppen2Controller {
public String index(KeycloakAuthenticationToken token, Model model) throws EventException {
Account account = keyCloakService.createAccountFromPrincipal(token);
User user = new User(account.getName(), account.getGivenname(), account.getFamilyname(), account.getEmail());
model.addAttribute("account", keyCloakService.createAccountFromPrincipal(token));
model.addAttribute("gruppen", userService.getUserGroups(user));
model.addAttribute("user",user);
return "index";
}
@RolesAllowed({"ROLE_orga", "ROLE_actuator)"})
@GetMapping("/createLecture")
public String createLecture(KeycloakAuthenticationToken token, Model model) {
model.addAttribute("account", keyCloakService.createAccountFromPrincipal(token));
return "createLecture";
}
@RolesAllowed({"ROLE_orga", "ROLE_studentin", "ROLE_actuator)"})
@GetMapping("/createGroup")
public String createGroup(KeycloakAuthenticationToken token, Model model) {

View File

@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
</body>
</html>

View File

@ -21,6 +21,10 @@
<li>
<a th:href="@{/gruppen2/findGroup}" href="/findGroup">Suche</a>
</li>
<!-- Fix double point -->
<li th:if="${account.getRoles().contains('orga')}">
<a th:href="@{/gruppen2/createLecture}" href="/createLecture">Veranstaltung</a>
</li>
</ul>
</nav>
</header>