Ignore:
Timestamp:
02/10/23 01:52:11 (21 months ago)
Author:
DenicaKj <dkorvezir@…>
Branches:
master
Children:
ef84238
Parents:
73f0dbc
Message:

Profiles for user and worker

Location:
src/main/java/com/example/moviezone
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/com/example/moviezone/config/WebSecurityConfig.java

    r73f0dbc r7926d68  
    3333                .authorizeRequests()
    3434                .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")
    3636                .antMatchers("/**").hasRole("ADMIN")
    3737                .anyRequest()
  • src/main/java/com/example/moviezone/repository/WorkerRepository.java

    r73f0dbc r7926d68  
    77@Repository
    88public interface WorkerRepository extends JpaRepository<Worker,Integer> {
     9    Worker getByUsername(String username);
    910}
  • src/main/java/com/example/moviezone/service/Impl/WorkerServiceImpl.java

    r73f0dbc r7926d68  
    2020        return workerRepository.findAll();
    2121    }
     22
     23    @Override
     24    public Worker getWorkerByUsername(String username) {
     25        return workerRepository.getByUsername(username);
     26    }
    2227}
  • src/main/java/com/example/moviezone/service/WorkerService.java

    r73f0dbc r7926d68  
    77public interface WorkerService {
    88    List<Worker> findAllWorkers();
     9    Worker getWorkerByUsername(String username);
    910}
  • src/main/java/com/example/moviezone/web/HomeController.java

    r73f0dbc r7926d68  
    403403        return "redirect:/home/getFilm/"+id;
    404404    }
    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    }
    406422}
Note: See TracChangeset for help on using the changeset viewer.