diff options
author | Georg Pfuetzenreuter | 2022-05-08 04:21:35 +0200 |
---|---|---|
committer | Georg Pfuetzenreuter | 2022-05-08 04:21:35 +0200 |
commit | cbec25cd6b5fe37f3010ab163b1bca61a743c457 (patch) | |
tree | 0be07889aa04b3ce710ab9c247308fba0b8b9ec4 /src | |
parent | f105d0e1ab01fca7a04f54a8cacf6372a5b2d6c0 (diff) | |
download | pubsh-web-cbec25cd6b5fe37f3010ab163b1bca61a743c457.tar.gz pubsh-web-cbec25cd6b5fe37f3010ab163b1bca61a743c457.tar.bz2 pubsh-web-cbec25cd6b5fe37f3010ab163b1bca61a743c457.zip |
User -> portal, Admin -> admin
Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/net/libertacasa/pubsh/web/SecurityConfig.java | 1 | ||||
-rw-r--r-- | src/main/java/net/libertacasa/pubsh/web/WebApplication.java | 8 | ||||
-rw-r--r-- | src/main/resources/templates/admin.html (renamed from src/main/resources/templates/user.html) | 25 | ||||
-rw-r--r-- | src/main/resources/templates/portal.html | 25 |
4 files changed, 30 insertions, 29 deletions
diff --git a/src/main/java/net/libertacasa/pubsh/web/SecurityConfig.java b/src/main/java/net/libertacasa/pubsh/web/SecurityConfig.java index 53f83ab..14b6dcb 100644 --- a/src/main/java/net/libertacasa/pubsh/web/SecurityConfig.java +++ b/src/main/java/net/libertacasa/pubsh/web/SecurityConfig.java @@ -36,6 +36,7 @@ public class SecurityConfig extends KeycloakWebSecurityConfigurerAdapter { http .authorizeRequests() .antMatchers("/portal").hasAuthority("devel-user") + .antMatchers("/admin").hasAuthority("devel-admins") .anyRequest().permitAll(); } } diff --git a/src/main/java/net/libertacasa/pubsh/web/WebApplication.java b/src/main/java/net/libertacasa/pubsh/web/WebApplication.java index d4094f6..ad9ed9b 100644 --- a/src/main/java/net/libertacasa/pubsh/web/WebApplication.java +++ b/src/main/java/net/libertacasa/pubsh/web/WebApplication.java @@ -45,7 +45,7 @@ public class WebApplication { } - @GetMapping("/portal") + @GetMapping("/admin") public String portal(Model model) throws pubshError { KeycloakAuthenticationToken authentication = (KeycloakAuthenticationToken) SecurityContextHolder.getContext().getAuthentication(); @@ -101,10 +101,10 @@ public class WebApplication { model.addAttribute("availableOs", availableOs); //model.addAttribute("osChoice", new String()); - return("portal"); + return("admin"); } - @GetMapping("/user") + @GetMapping("/portal") public String user(Model model) throws pubshError { KeycloakAuthenticationToken authentication = (KeycloakAuthenticationToken) SecurityContextHolder.getContext().getAuthentication(); @@ -146,7 +146,7 @@ public class WebApplication { model.addAttribute("docker_containers", containers); model.addAttribute("availableOs", availableOs); - return("user"); + return("portal"); } @DeleteMapping("/frontend/container/delete/{id}") diff --git a/src/main/resources/templates/user.html b/src/main/resources/templates/admin.html index a5473ee..d2f1847 100644 --- a/src/main/resources/templates/user.html +++ b/src/main/resources/templates/admin.html @@ -40,7 +40,10 @@ </select> <button class="btn btn-primary" th:id="request_submission" th:type="submit">Generate</button> </form> - + + + + <h2>Existing containers:</h2> <table> <tr th:each="container: ${docker_containers}"> @@ -48,15 +51,35 @@ <td th:text="${container.image}" /> <td th:text="${container.id}" /> <td th:text="${container.status}" /> + <!-- td><form id="deletion_pseudoform" action="#" th:action="@{'/frontend/container/delete/{id}'(id=${container.id})}" th:method="delete" > + <input type="hidden" name="_method" value="delete" /> + <button id="deletion_submission" type="submit">Delete</button> +</form></td--> <td> <form id="deletion_pseudoform" action="#" th:action="@{'/frontend/container/delete/{id}'(id=${container.id})}" th:method="delete" th:containerid="${container.id}" th:containerShaSum="${container.imageId}" th:onsubmit="return confirm('Do you really want to delete the container with ID ' + this.getAttribute('containerid') + ' which is attached to the image with checksum ' + this.getAttribute('containerShaSum') + ' ?');"> +<!--a + href="" + class="btn btn-danger " + th:data-confirm-delete="|Are you sure you want to delete the container with ID ${container.id}?|" + onclick="if (!confirm(this.getAttribute('data-confirm-delete'))) return false" +> + Delete +</a--> <button class="btn btn-danger" id="deletion_submission" type="submit">Delete</button> </form> </td> + <!-- th:data-confirm-delete="|Are you sure you want to delete this employee ${tempEmployee.firstName}?|" + onclick="if (!confirm(this.getAttribute('data-confirm-delete'))) return false" --> + </tr> </table> + + + + <!--div id="pagefoot" th:include="layout :: footerFragment">Footer</div--> <p></p> <a href="/logout">Logout</a> </div> + <!-- container --> </body> </html> diff --git a/src/main/resources/templates/portal.html b/src/main/resources/templates/portal.html index d2f1847..a5473ee 100644 --- a/src/main/resources/templates/portal.html +++ b/src/main/resources/templates/portal.html @@ -40,10 +40,7 @@ </select> <button class="btn btn-primary" th:id="request_submission" th:type="submit">Generate</button> </form> - - - - + <h2>Existing containers:</h2> <table> <tr th:each="container: ${docker_containers}"> @@ -51,35 +48,15 @@ <td th:text="${container.image}" /> <td th:text="${container.id}" /> <td th:text="${container.status}" /> - <!-- td><form id="deletion_pseudoform" action="#" th:action="@{'/frontend/container/delete/{id}'(id=${container.id})}" th:method="delete" > - <input type="hidden" name="_method" value="delete" /> - <button id="deletion_submission" type="submit">Delete</button> -</form></td--> <td> <form id="deletion_pseudoform" action="#" th:action="@{'/frontend/container/delete/{id}'(id=${container.id})}" th:method="delete" th:containerid="${container.id}" th:containerShaSum="${container.imageId}" th:onsubmit="return confirm('Do you really want to delete the container with ID ' + this.getAttribute('containerid') + ' which is attached to the image with checksum ' + this.getAttribute('containerShaSum') + ' ?');"> -<!--a - href="" - class="btn btn-danger " - th:data-confirm-delete="|Are you sure you want to delete the container with ID ${container.id}?|" - onclick="if (!confirm(this.getAttribute('data-confirm-delete'))) return false" -> - Delete -</a--> <button class="btn btn-danger" id="deletion_submission" type="submit">Delete</button> </form> </td> - <!-- th:data-confirm-delete="|Are you sure you want to delete this employee ${tempEmployee.firstName}?|" - onclick="if (!confirm(this.getAttribute('data-confirm-delete'))) return false" --> - </tr> </table> - - - - <!--div id="pagefoot" th:include="layout :: footerFragment">Footer</div--> <p></p> <a href="/logout">Logout</a> </div> - <!-- container --> </body> </html> |