- Timestamp:
- 02/10/23 01:52:11 (23 months ago)
- Branches:
- master
- Children:
- ef84238
- Parents:
- 73f0dbc
- Location:
- src/main
- Files:
-
- 2 added
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/com/example/moviezone/config/WebSecurityConfig.java
r73f0dbc r7926d68 33 33 .authorizeRequests() 34 34 .antMatchers("/","/films","/home/projections","/home/events","/home/getProjections/**","/home/films","/home/getFilm/**","/getFilm/**","/home/getEvent/**","/getEvent/**","/login","/events","/projections" ,"/home", "/assets/**", "/register", "/api/**").permitAll() 35 .antMatchers("/home/getSeats/**","/myTickets","/home/addRating/**","/addRating/**","/getProjection/**","/home/makeReservation" ).hasRole("USER")35 .antMatchers("/home/getSeats/**","/myTickets","/home/addRating/**","/addRating/**","/getProjection/**","/home/makeReservation","/profileUser").hasRole("USER") 36 36 .antMatchers("/**").hasRole("ADMIN") 37 37 .anyRequest() -
src/main/java/com/example/moviezone/repository/WorkerRepository.java
r73f0dbc r7926d68 7 7 @Repository 8 8 public interface WorkerRepository extends JpaRepository<Worker,Integer> { 9 Worker getByUsername(String username); 9 10 } -
src/main/java/com/example/moviezone/service/Impl/WorkerServiceImpl.java
r73f0dbc r7926d68 20 20 return workerRepository.findAll(); 21 21 } 22 23 @Override 24 public Worker getWorkerByUsername(String username) { 25 return workerRepository.getByUsername(username); 26 } 22 27 } -
src/main/java/com/example/moviezone/service/WorkerService.java
r73f0dbc r7926d68 7 7 public interface WorkerService { 8 8 List<Worker> findAllWorkers(); 9 Worker getWorkerByUsername(String username); 9 10 } -
src/main/java/com/example/moviezone/web/HomeController.java
r73f0dbc r7926d68 403 403 return "redirect:/home/getFilm/"+id; 404 404 } 405 405 @GetMapping("/profileWorker") 406 public String getWorkerProfile(Model model,HttpServletRequest request) 407 { 408 Worker worker=workerService.getWorkerByUsername(request.getRemoteUser()); 409 model.addAttribute("worker",worker); 410 model.addAttribute("bodyContent", "profileWorker"); 411 return "master-template"; 412 } 413 @GetMapping("/profileUser") 414 public String getUserProfile(Model model,HttpServletRequest request) 415 { 416 Customer customer=customerService.findByUsername(request.getRemoteUser()); 417 System.out.println(customer.getFirst_name()); 418 model.addAttribute("customer",customer); 419 model.addAttribute("bodyContent", "profileUser"); 420 return "master-template"; 421 } 406 422 } -
src/main/resources/templates/fragments/header.html
r73f0dbc r7926d68 83 83 </ul> 84 84 <ul class="menu-right"> 85 <th:block th:if="${#request.getRemoteUser() != null}">85 <th:block sec:authorize="hasAuthority('ROLE_ADMIN')" th:if="${#request.getRemoteUser() != null}"> 86 86 <li class="reg"> 87 <a href="/"> 87 <a href="/profileWorker"> 88 <th:block th:text="${#request.getRemoteUser()}"></th:block> 89 </a> 90 </li> 91 </th:block> 92 <th:block sec:authorize="hasAuthority('ROLE_USER')" th:if="${#request.getRemoteUser() != null}"> 93 <li class="reg"> 94 <a href="/profileUser"> 88 95 <th:block th:text="${#request.getRemoteUser()}"></th:block> 89 96 </a>
Note:
See TracChangeset
for help on using the changeset viewer.