release/2025-02-20-10-46

This commit is contained in:
geniy 2025-02-20 11:23:13 +03:00
parent d826b80c26
commit 75e925419a
2 changed files with 9 additions and 14 deletions

View File

@ -23,23 +23,22 @@ public class AdminController {
private void amIAdmin() {} private void amIAdmin() {}
@PostMapping("/panel/get-employee-info") @PostMapping("/panel/get-employee-info")
private EmployeeDataDto getEmployeeInfo(@RequestParam("employee-login") String employeeLogin) { private EmployeeDataDto getEmployeeInfo(@RequestParam("employee-login") String employeeLogin, Authentication authentication) {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
String login = authentication.getName(); String login = authentication.getName();
return adminService.getEmployeeInfo(employeeLogin, login); return adminService.getEmployeeInfo(employeeLogin, login);
} }
@PostMapping("/panel/set-block-condition") @PostMapping("/panel/set-block-condition")
private void setBlockCondition(@RequestParam("employee-login") String employeeLogin, private void setBlockCondition(@RequestParam("employee-login") String employeeLogin,
@RequestParam("block-condition") boolean blockCondition) { @RequestParam("block-condition") boolean blockCondition,
Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); Authentication authentication) {
String login = authentication.getName(); String login = authentication.getName();
adminService.setBlockCondition(employeeLogin, blockCondition, login); adminService.setBlockCondition(employeeLogin, blockCondition, login);
} }
@PostMapping("/panel/get-employee-entry-list") @PostMapping("/panel/get-employee-entry-list")
private List<EntryDto> getEmployeeEntryList(@RequestParam("employee-login") String employeeLogin) { private List<EntryDto> getEmployeeEntryList(@RequestParam("employee-login") String employeeLogin,
Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); Authentication authentication) {
String login = authentication.getName(); String login = authentication.getName();
return adminService.getEmployeeEntryList(employeeLogin, login); return adminService.getEmployeeEntryList(employeeLogin, login);
} }

View File

@ -20,29 +20,25 @@ public class EmployeeController {
private void auth() {} private void auth() {}
@PostMapping("/info") @PostMapping("/info")
private EmployeeDataDto info() { private EmployeeDataDto info(Authentication authentication) {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
String login = authentication.getName(); String login = authentication.getName();
return employeeService.info(login); return employeeService.info(login);
} }
@PostMapping("/open") @PostMapping("/open")
private void open(@RequestParam("value") long value) { private void open(@RequestParam("value") long value, Authentication authentication) {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
String login = authentication.getName(); String login = authentication.getName();
employeeService.open(login, value); employeeService.open(login, value);
} }
@PostMapping("/get-entry-list") @PostMapping("/get-entry-list")
private List<EntryDto> getEntryList() { private List<EntryDto> getEntryList(Authentication authentication) {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
String login = authentication.getName(); String login = authentication.getName();
return employeeService.getEntryList(login); return employeeService.getEntryList(login);
} }
@PostMapping("/am-i-blocked") @PostMapping("/am-i-blocked")
private boolean amIBlocked() { private boolean amIBlocked(Authentication authentication) {
Authentication authentication = SecurityContextHolder.getContext().getAuthentication();
String login = authentication.getName(); String login = authentication.getName();
return employeeService.amIBlocked(login); return employeeService.amIBlocked(login);
} }