|
|
@@ -3,10 +3,12 @@ package com.ffii.tsms.config.security.jwt.web; |
|
|
|
import java.time.Instant; |
|
|
|
import java.util.HashSet; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Objects; |
|
|
|
import java.util.Set; |
|
|
|
|
|
|
|
import com.ffii.tsms.modules.data.entity.Staff; |
|
|
|
import com.ffii.tsms.modules.data.entity.StaffRepository; |
|
|
|
import com.ffii.tsms.modules.data.service.StaffsService; |
|
|
|
import com.ffii.tsms.modules.user.service.GroupService; |
|
|
|
import org.apache.commons.lang3.exception.ExceptionUtils; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
@@ -58,6 +60,9 @@ public class JwtAuthenticationController { |
|
|
|
@Autowired |
|
|
|
private GroupService groupService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private StaffsService staffsService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private StaffRepository staffRepository; |
|
|
|
|
|
|
@@ -102,7 +107,7 @@ public class JwtAuthenticationController { |
|
|
|
|
|
|
|
final Map<String, Object> args = Map.of("userId", user.getId()); |
|
|
|
final String role = groupService.getGroupName(args); |
|
|
|
final Staff staff = staffRepository.findIdAndNameByUserIdAndDeletedFalse(user.getId()).orElse(null); |
|
|
|
final Map<String, Object> staff = Objects.requireNonNull(staffsService.getCurrentStaff(user.getId())).orElse(null); |
|
|
|
|
|
|
|
Set<AbilityModel> abilities = new HashSet<>(); |
|
|
|
userAuthorityService.getUserAuthority(user).forEach(auth -> abilities.add(new AbilityModel(auth.getAuthority()))); |
|
|
|