diff --git a/src/main/java/polish_community_group_11/polish_community/security/WebSecurityConfig.java b/src/main/java/polish_community_group_11/polish_community/security/WebSecurityConfig.java index 3119b99b7968d0bfe754d5a243c95d251d938388..3b5e40a5b77ec2c801786878d75d1f791a8608e0 100644 --- a/src/main/java/polish_community_group_11/polish_community/security/WebSecurityConfig.java +++ b/src/main/java/polish_community_group_11/polish_community/security/WebSecurityConfig.java @@ -37,7 +37,7 @@ public class WebSecurityConfig { private final String[] whiteListingPath = { // "/event", // "event/*" -// "/api/feed/**" , + "/feed" }; public WebSecurityConfig(UserService userService, RoleService roleService) { diff --git a/src/main/resources/templates/event/event.html b/src/main/resources/templates/event/event.html index c4e3731ac6202bb777f5f59c9b499864661a5657..ca7d771d1c0f37da90cc47b1834cc1d207a3e648 100644 --- a/src/main/resources/templates/event/event.html +++ b/src/main/resources/templates/event/event.html @@ -1,7 +1,9 @@ <!DOCTYPE html> <html xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" - layout:decorate="~{layout/layout}"> + layout:decorate="~{layout/layout}" + xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity6" +> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> @@ -12,7 +14,7 @@ <div id="event-details" class="event-details"> <div class="general-headings-layout"> <h1>Community Events</h1> - <a th:href="@{event/add}"><button class="add-event-button">Add Event</button></a> + <a th:href="@{event/add}"><button class="add-event-button" sec:authorize="isAuthenticated()" >Add Event</button></a> </div> <div class="event-grid"> <!-- Loop through each event and create a clickable link --> @@ -28,9 +30,9 @@ <p><strong>Location:</strong> <span th:text="${event.getLocation()}">Event location</span></p> </a> </div> - <div class ="event-card-button"> + <div class ="event-card-button" sec:authorize="isAuthenticated()"> <button class="register-button">Register Now</button> - <a th:href="@{/event/edit/{id}(id=${event.getEvent_id()})}" class="event-link"><button>Edit Event</button></a> + <a th:href="@{/event/edit/{id}(id=${event.getEvent_id()})}" class="event-link" ><button>Edit Event</button></a> </div> </div> </div> diff --git a/src/main/resources/templates/feed/feed.html b/src/main/resources/templates/feed/feed.html index 058d86c2839162c3036e38cca1d1b74d172ae8cb..84778d0321f96e926c2ab8809190dadb77ee360e 100644 --- a/src/main/resources/templates/feed/feed.html +++ b/src/main/resources/templates/feed/feed.html @@ -2,7 +2,9 @@ <html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" - layout:decorate="~{layout/layout}"> + layout:decorate="~{layout/layout}" + xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity6" +> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> @@ -19,7 +21,7 @@ <!-- posts will appear here --> <div id="postFeed" class="post-feed"> <!-- using template since I want to use it in javascript --> - <template id="post-template"> + <template id="post-template" > <div class="post"> <div class="post-header"> <div class="author-details"> @@ -71,7 +73,7 @@ </template> </div> - <button class="add-post" id="add-post"> + <button class="add-post" id="add-post" > <i class="bi bi-plus"></i> </button> <div id="create-new-modal" class="create-new-modal"> diff --git a/src/main/resources/templates/news/newsList.html b/src/main/resources/templates/news/newsList.html index 2e2a97ce2b01f99b9bfcedce8662a2fcab204ff6..bc226835b57afb4b9271d93852894f8a519028ec 100644 --- a/src/main/resources/templates/news/newsList.html +++ b/src/main/resources/templates/news/newsList.html @@ -1,6 +1,8 @@ <!DOCTYPE html> <html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" - layout:decorate="~{layout/layout}"> + layout:decorate="~{layout/layout}" + xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity6" +> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> @@ -13,7 +15,7 @@ <section layout:fragment="content" class="content"> <div class="general-headings-layout"> <h1>Community News</h1> - <button onclick="openNewsForm()" id="openModalBtn" class="openModalBtn">Add News</button> + <button onclick="openNewsForm()" id="openModalBtn" class="openModalBtn" sec:authorize="isAuthenticated()" >Add News</button> </div> <main class="news-container"> <!-- Main news card --> @@ -29,7 +31,7 @@ </div> <div class="card-footer"> <p class="source">Source: <span th:text="${newsList[0].getNews_source()}"></span></p> - <a th:href="@{/editNews/{id}(id=${newsList[0].getNews_id()})}" class="modify-btn modify-link">Modify</a> + <a th:href="@{/editNews/{id}(id=${newsList[0].getNews_id()})}" class="modify-btn modify-link" sec:authorize="isAuthenticated()" >Modify</a> <p class="date" th:text="${newsList[0].getNews_upload_date()}"></p> </div> </div> @@ -42,7 +44,7 @@ <div class="card-footer"> <p class="source">Source: <span th:text="${news.getNews_source()}"></span></p> <p class="date" th:text="${news.getNews_upload_date()}"></p> - <a th:href="@{/editNews/{id}(id=${news.getNews_id()})}" class="modify-btn modify-link">Modify</a> + <a th:href="@{/editNews/{id}(id=${news.getNews_id()})}" class="modify-btn modify-link" sec:authorize="isAuthenticated()">Modify</a> </div> </div> </div>