@@ -16,8 +16,6 @@ public class JwtResponse implements Serializable { | |||||
private final String refreshToken; | private final String refreshToken; | ||||
private final String role; | private final String role; | ||||
//private final Set<AbilityModel> abilities; | //private final Set<AbilityModel> abilities; | ||||
private final Long subDivisionId; | |||||
private final Boolean lotusNotesUser; | |||||
private final List<String> abilities; | private final List<String> abilities; | ||||
public JwtResponse(String accessToken, String refreshToken, String role, User user, /*Set<AbilityModel>*/List<String> abilities) { | public JwtResponse(String accessToken, String refreshToken, String role, User user, /*Set<AbilityModel>*/List<String> abilities) { | ||||
@@ -27,8 +25,6 @@ public class JwtResponse implements Serializable { | |||||
this.id = user.getId(); | this.id = user.getId(); | ||||
this.name = user.getName(); | this.name = user.getName(); | ||||
this.email = user.getEmail(); | this.email = user.getEmail(); | ||||
this.subDivisionId = user.getSubDivisionId(); | |||||
this.lotusNotesUser = user.getLotusNotesUser(); | |||||
this.abilities = abilities; | this.abilities = abilities; | ||||
} | } | ||||
@@ -60,16 +56,4 @@ public class JwtResponse implements Serializable { | |||||
return abilities; | return abilities; | ||||
} | } | ||||
public Long getSubDivisionId() { | |||||
return this.subDivisionId; | |||||
} | |||||
public Boolean isLotusNotesUser() { | |||||
return this.lotusNotesUser; | |||||
} | |||||
public Boolean getLotusNotesUser() { | |||||
return this.lotusNotesUser; | |||||
} | |||||
} | } |
@@ -75,17 +75,6 @@ public class User extends BaseEntity<Long> implements UserDetails { | |||||
@Column | @Column | ||||
private String remarks; | private String remarks; | ||||
@Column | |||||
private boolean lotusNotesUser = false; | |||||
@Column | |||||
private String post; | |||||
@Column | |||||
private Long subDivisionId; | |||||
@Column | |||||
private boolean reminderFlag; | |||||
public boolean isLocked() { | public boolean isLocked() { | ||||
return this.locked == null ? false : this.locked; | return this.locked == null ? false : this.locked; | ||||
@@ -248,44 +237,4 @@ public class User extends BaseEntity<Long> implements UserDetails { | |||||
this.department = department; | this.department = department; | ||||
} | } | ||||
public boolean isLotusNotesUser() { | |||||
return this.lotusNotesUser; | |||||
} | |||||
public boolean getLotusNotesUser() { | |||||
return this.lotusNotesUser; | |||||
} | |||||
public void setLotusNotesUser(boolean lotusNotesUser) { | |||||
this.lotusNotesUser = lotusNotesUser; | |||||
} | |||||
public String getPost() { | |||||
return this.post; | |||||
} | |||||
public void setPost(String post) { | |||||
this.post = post; | |||||
} | |||||
public Long getSubDivisionId() { | |||||
return this.subDivisionId; | |||||
} | |||||
public void setSubDivisionId(Long subDivisionId) { | |||||
this.subDivisionId = subDivisionId; | |||||
} | |||||
public boolean isReminderFlag() { | |||||
return this.reminderFlag; | |||||
} | |||||
public boolean getReminderFlag() { | |||||
return this.reminderFlag; | |||||
} | |||||
public void setReminderFlag(boolean reminderFlag) { | |||||
this.reminderFlag = reminderFlag; | |||||
} | |||||
} | } |
@@ -36,12 +36,10 @@ public class NewLionerUserReq { | |||||
private String phone2; | private String phone2; | ||||
private String post; | private String post; | ||||
@NotBlank | @NotBlank | ||||
private Long subDivisionId; | |||||
private Long userGroupId; | |||||
private LocalDate expiryDate; | private LocalDate expiryDate; | ||||
private String locale; | private String locale; | ||||
private String remarks; | private String remarks; | ||||
private Boolean lotusNotesUser; | |||||
private Boolean reminderFlag; | |||||
@NotBlank | @NotBlank | ||||
@@ -56,30 +54,6 @@ public class NewLionerUserReq { | |||||
private List<Long> addAuthIds; | private List<Long> addAuthIds; | ||||
// @NotNull | // @NotNull | ||||
private List<Long> removeAuthIds; | private List<Long> removeAuthIds; | ||||
public Boolean isLotusNotesUser() { | |||||
return this.lotusNotesUser; | |||||
} | |||||
public Boolean getLotusNotesUser() { | |||||
return this.lotusNotesUser; | |||||
} | |||||
public Boolean isReminderFlag() { | |||||
return this.reminderFlag; | |||||
} | |||||
public Boolean getReminderFlag() { | |||||
return this.reminderFlag; | |||||
} | |||||
public void setReminderFlag(Boolean reminderFlag) { | |||||
this.reminderFlag = reminderFlag; | |||||
} | |||||
public void setLotusNotesUser(Boolean lotusNotesUser) { | |||||
this.lotusNotesUser = lotusNotesUser; | |||||
} | |||||
public Long getId() { | public Long getId() { | ||||
return this.id; | return this.id; | ||||
@@ -234,12 +208,12 @@ public class NewLionerUserReq { | |||||
this.post = post; | this.post = post; | ||||
} | } | ||||
public Long getSubDivisionId() { | |||||
return this.subDivisionId; | |||||
public Long getUserGroupId() { | |||||
return this.userGroupId; | |||||
} | } | ||||
public void setSubDivisionId(Long subDivisionId) { | |||||
this.subDivisionId = subDivisionId; | |||||
public void setUserGroupId(Long userGroupId) { | |||||
this.userGroupId = userGroupId; | |||||
} | } | ||||
public String getUsername() { | public String getUsername() { | ||||
@@ -15,7 +15,6 @@ public class SearchUserReq { | |||||
private Integer subDivisionId; | private Integer subDivisionId; | ||||
private String email; | private String email; | ||||
private String phone; | private String phone; | ||||
private Boolean isLotusNotesUser; | |||||
public Integer getId() { | public Integer getId() { | ||||
return id; | return id; | ||||
@@ -117,16 +116,4 @@ public class SearchUserReq { | |||||
this.phone = phone; | this.phone = phone; | ||||
} | } | ||||
public Boolean isIsLotusNotesUser() { | |||||
return this.isLotusNotesUser; | |||||
} | |||||
public Boolean getIsLotusNotesUser() { | |||||
return this.isLotusNotesUser; | |||||
} | |||||
public void setIsLotusNotesUser(Boolean isLotusNotesUser) { | |||||
this.isLotusNotesUser = isLotusNotesUser; | |||||
} | |||||
} | } |
@@ -29,7 +29,8 @@ public class UpdateUserReq { | |||||
private String email; | private String email; | ||||
@NotBlank | @NotBlank | ||||
private String department; | private String department; | ||||
private Integer userGroupId; | |||||
// @NotNull | // @NotNull | ||||
private List<Integer> addGroupIds; | private List<Integer> addGroupIds; | ||||
// @NotNull | // @NotNull | ||||
@@ -92,6 +93,14 @@ public class UpdateUserReq { | |||||
this.firstname = firstname; | this.firstname = firstname; | ||||
} | } | ||||
public Integer getUserGroupId() { | |||||
return userGroupId; | |||||
} | |||||
public void setUserGroupId(Integer userGroupId) { | |||||
this.userGroupId = userGroupId; | |||||
} | |||||
public List<Integer> getAddGroupIds() { | public List<Integer> getAddGroupIds() { | ||||
return addGroupIds; | return addGroupIds; | ||||
} | } | ||||
@@ -13,6 +13,7 @@ import java.util.Optional; | |||||
import java.util.Set; | import java.util.Set; | ||||
import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
import org.apache.commons.collections4.Put; | |||||
import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
import com.ffii.core.utils.BeanUtils; | import com.ffii.core.utils.BeanUtils; | ||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
@@ -134,15 +135,10 @@ public class UserService extends AbstractBaseEntityService<User, Long, UserRepos | |||||
+ " u.name , " | + " u.name , " | ||||
+ " u.fullname, " | + " u.fullname, " | ||||
+ " u.email, " | + " u.email, " | ||||
+ " u.phone1, " | |||||
+ " u.lotusNotesUser, " | |||||
+ " u.reminderFlag, " | |||||
+ " u.post, " | |||||
+ " sd.name " | |||||
+ " u.phone1 " | |||||
+ " FROM `user` u " | + " FROM `user` u " | ||||
+ " LEFT JOIN `user` u1 ON u1.id = u.createdBy " | + " LEFT JOIN `user` u1 ON u1.id = u.createdBy " | ||||
+ " LEFT JOIN `user` u2 ON u2.id = u.modifiedBy " | + " LEFT JOIN `user` u2 ON u2.id = u.modifiedBy " | ||||
+ " LEFT JOIN sub_division sd ON sd.id = u.subDivisionId " | |||||
+ " WHERE u.id = :id " | + " WHERE u.id = :id " | ||||
); | ); | ||||
@@ -214,19 +210,21 @@ public class UserService extends AbstractBaseEntityService<User, Long, UserRepos | |||||
+ " u.remarks, " | + " u.remarks, " | ||||
+ " u.fullname, " | + " u.fullname, " | ||||
+ " u.post, " | + " u.post, " | ||||
+ " u.lotusNotesUser, " | |||||
+ " sd.name as subDivision" | |||||
+ " ug.groupId " | |||||
// + " sd.name as subDivision" | |||||
+ " FROM `user` u" | + " FROM `user` u" | ||||
+ " left join user_group ug on u.id = ug.userId" | + " left join user_group ug on u.id = ug.userId" | ||||
+ " left join sub_division sd on u.subDivisionId = sd.id " | |||||
// + " left join sub_division sd on u.subDivisionId = sd.id " | |||||
+ " where u.deleted = false"); | + " where u.deleted = false"); | ||||
if (req != null) { | if (req != null) { | ||||
if (req.getId() != null) | if (req.getId() != null) | ||||
sql.append(" AND u.id = :id"); | sql.append(" AND u.id = :id"); | ||||
if (req.getGroupId() != null) | |||||
if (req.getGroupId() != null) { | |||||
sql.append(" AND ug.groupId = :groupId"); | sql.append(" AND ug.groupId = :groupId"); | ||||
} | |||||
if (StringUtils.isNotBlank(req.getUsername())) { | if (StringUtils.isNotBlank(req.getUsername())) { | ||||
req.setUsername("%" + req.getUsername() + "%"); | req.setUsername("%" + req.getUsername() + "%"); | ||||
sql.append(" AND u.username LIKE :username"); | sql.append(" AND u.username LIKE :username"); | ||||
@@ -260,10 +258,6 @@ public class UserService extends AbstractBaseEntityService<User, Long, UserRepos | |||||
sql.append(" AND u.locked = :locked"); | sql.append(" AND u.locked = :locked"); | ||||
} | } | ||||
if (req.getIsLotusNotesUser() != null) { | |||||
sql.append(" AND u.lotusNotesUser = :isLotusNotesUser"); | |||||
} | |||||
} | } | ||||
sql.append(" ORDER BY u.username asc"); | sql.append(" ORDER BY u.username asc"); | ||||
@@ -275,6 +269,16 @@ public class UserService extends AbstractBaseEntityService<User, Long, UserRepos | |||||
return jdbcDao.queryForList(sql.toString(), req, UserRecord.class); | return jdbcDao.queryForList(sql.toString(), req, UserRecord.class); | ||||
} | } | ||||
public Integer getUserGroupId(long id) { | |||||
return jdbcDao.queryForInt( | |||||
"SELECT" | |||||
+ " MAX(ug.groupId) AS groupId" | |||||
+ " FROM user_group ug" | |||||
+ " WHERE ug.userId = :id" | |||||
+ " GROUP BY ug.userId", | |||||
Map.of(Params.ID, id)); | |||||
} | |||||
public List<Integer> listUserAuthId(long id) { | public List<Integer> listUserAuthId(long id) { | ||||
return jdbcDao.queryForInts( | return jdbcDao.queryForInts( | ||||
"SELECT" | "SELECT" | ||||
@@ -388,8 +392,8 @@ public class UserService extends AbstractBaseEntityService<User, Long, UserRepos | |||||
throw new UnprocessableEntityException(ErrorCodes.USERNAME_NOT_AVAILABLE); | throw new UnprocessableEntityException(ErrorCodes.USERNAME_NOT_AVAILABLE); | ||||
} | } | ||||
String submitedPassword = req.getPassword(); | |||||
String pwdHash = passwordEncoder.encode(submitedPassword); | |||||
String submittedPassword = req.getPassword(); | |||||
String pwdHash = passwordEncoder.encode(submittedPassword); | |||||
req.setPassword(pwdHash); | req.setPassword(pwdHash); | ||||
User instance = new User(); | User instance = new User(); | ||||
@@ -412,7 +416,7 @@ public class UserService extends AbstractBaseEntityService<User, Long, UserRepos | |||||
} | } | ||||
if (req.getPassword() != null && req.getPassword() != "" && req.getPassword().length() > 1) { | if (req.getPassword() != null && req.getPassword() != "" && req.getPassword().length() > 1) { | ||||
String submitedPassword = req.getPassword(); | |||||
String submittedPassword = req.getPassword(); | |||||
PasswordRule rule = new PasswordRule(settingsService); | PasswordRule rule = new PasswordRule(settingsService); | ||||
if (!PasswordUtils.checkPwd(req.getPassword(), rule, req.getUsername())) { | if (!PasswordUtils.checkPwd(req.getPassword(), rule, req.getUsername())) { | ||||
@@ -427,7 +431,7 @@ public class UserService extends AbstractBaseEntityService<User, Long, UserRepos | |||||
}); | }); | ||||
} | } | ||||
String pwdHash = passwordEncoder.encode(submitedPassword); | |||||
String pwdHash = passwordEncoder.encode(submittedPassword); | |||||
req.setPassword(pwdHash); | req.setPassword(pwdHash); | ||||
} else { | } else { | ||||
@@ -467,45 +471,62 @@ public class UserService extends AbstractBaseEntityService<User, Long, UserRepos | |||||
record = userPasswordHistoryService.save(record); | record = userPasswordHistoryService.save(record); | ||||
} | } | ||||
List<Map<String, Long>> authBatchInsertValues = req.getAddAuthIds().stream() | |||||
.map(authId -> Map.of("userId", id, "authId", authId)) | |||||
.collect(Collectors.toList()); | |||||
List<Map<String, Long>> authBatchDeleteValues = req.getRemoveAuthIds().stream() | |||||
.map(authId -> Map.of("userId", id, "authId", authId)) | |||||
.collect(Collectors.toList()); | |||||
if (!authBatchInsertValues.isEmpty()) { | |||||
jdbcDao.batchUpdate( | |||||
"INSERT IGNORE INTO user_authority (userId, authId)" | |||||
+ " VALUES (:userId, :authId)", | |||||
authBatchInsertValues); | |||||
} | |||||
if (!authBatchDeleteValues.isEmpty()) { | |||||
jdbcDao.batchUpdate( | |||||
"DELETE FROM user_authority" | |||||
+ " WHERE userId = :userId AND authId = :authId", | |||||
authBatchDeleteValues); | |||||
Map<String, Long> userGroupMap = new HashMap<>(); | |||||
userGroupMap.put("userId", instance.getId()); | |||||
userGroupMap.put("groupId", req.getUserGroupId()); | |||||
if (req.getUserGroupId() > 0) { // The group id is updated | |||||
jdbcDao.executeUpdate( | |||||
"DELETE FROM user_group" | |||||
+ " WHERE userId = :userId;", | |||||
userGroupMap | |||||
); | |||||
jdbcDao.executeUpdate( | |||||
"INSERT IGNORE INTO user_group (groupId,userId)" | |||||
+ " VALUES (:groupId, :userId);", | |||||
userGroupMap | |||||
); | |||||
} | } | ||||
List<Map<String, Long>> userBatchInsertValues = req.getAddGroupIds().stream() | |||||
.map(groupId -> Map.of("userId", id, "groupId", groupId)) | |||||
.collect(Collectors.toList()); | |||||
List<Map<String, Long>> userBatchDeleteValues = req.getRemoveGroupIds().stream() | |||||
.map(groupId -> Map.of("userId", id, "groupId", groupId)) | |||||
.collect(Collectors.toList()); | |||||
if (!userBatchInsertValues.isEmpty()) { | |||||
jdbcDao.batchUpdate( | |||||
"INSERT IGNORE INTO user_group (groupId,userId)" | |||||
+ " VALUES (:groupId, :userId)", | |||||
userBatchInsertValues); | |||||
} | |||||
if (!userBatchDeleteValues.isEmpty()) { | |||||
jdbcDao.batchUpdate( | |||||
"DELETE FROM user_group" | |||||
+ " WHERE groupId = :groupId AND userId = :userId", | |||||
userBatchDeleteValues); | |||||
} | |||||
// List<Map<String, Long>> authBatchInsertValues = req.getAddAuthIds().stream() | |||||
// .map(authId -> Map.of("userId", id, "authId", authId)) | |||||
// .collect(Collectors.toList()); | |||||
// List<Map<String, Long>> authBatchDeleteValues = req.getRemoveAuthIds().stream() | |||||
// .map(authId -> Map.of("userId", id, "authId", authId)) | |||||
// .collect(Collectors.toList()); | |||||
// if (!authBatchInsertValues.isEmpty()) { | |||||
// jdbcDao.batchUpdate( | |||||
// "INSERT IGNORE INTO user_authority (userId, authId)" | |||||
// + " VALUES (:userId, :authId)", | |||||
// authBatchInsertValues); | |||||
// } | |||||
// if (!authBatchDeleteValues.isEmpty()) { | |||||
// jdbcDao.batchUpdate( | |||||
// "DELETE FROM user_authority" | |||||
// + " WHERE userId = :userId AND authId = :authId", | |||||
// authBatchDeleteValues); | |||||
// } | |||||
// List<Map<String, Long>> userBatchInsertValues = req.getAddGroupIds().stream() | |||||
// .map(groupId -> Map.of("userId", id, "groupId", groupId)) | |||||
// .collect(Collectors.toList()); | |||||
// List<Map<String, Long>> userBatchDeleteValues = req.getRemoveGroupIds().stream() | |||||
// .map(groupId -> Map.of("userId", id, "groupId", groupId)) | |||||
// .collect(Collectors.toList()); | |||||
// if (!userBatchInsertValues.isEmpty()) { | |||||
// jdbcDao.batchUpdate( | |||||
// "INSERT IGNORE INTO user_group (groupId,userId)" | |||||
// + " VALUES (:groupId, :userId)", | |||||
// userBatchInsertValues); | |||||
// } | |||||
// if (!userBatchDeleteValues.isEmpty()) { | |||||
// jdbcDao.batchUpdate( | |||||
// "DELETE FROM user_group" | |||||
// + " WHERE groupId = :groupId AND userId = :userId", | |||||
// userBatchDeleteValues); | |||||
// } | |||||
// =====GET NEW AUDIT LOG=====// | // =====GET NEW AUDIT LOG=====// | ||||
if (instance != null && instance.getId() != null && instance.getId() > 0) { | if (instance != null && instance.getId() != null && instance.getId() > 0) { | ||||
@@ -13,6 +13,7 @@ public class UserRecord { | |||||
private String name; | private String name; | ||||
private Integer companyId; | private Integer companyId; | ||||
private Integer customerId; | private Integer customerId; | ||||
private Integer groupId; | |||||
private String locale; | private String locale; | ||||
private String fullname; | private String fullname; | ||||
private String firstname; | private String firstname; | ||||
@@ -24,9 +25,7 @@ public class UserRecord { | |||||
private String phone1; | private String phone1; | ||||
private String phone2; | private String phone2; | ||||
private String remarks; | private String remarks; | ||||
private Boolean lotusNotesUser; | |||||
private String post; | private String post; | ||||
private String subDivision; | |||||
public Boolean isLocked() { | public Boolean isLocked() { | ||||
return this.locked; | return this.locked; | ||||
@@ -35,10 +34,6 @@ public class UserRecord { | |||||
this.remarks = remarks; | this.remarks = remarks; | ||||
} | } | ||||
public Boolean isLotusNotesUser() { | |||||
return this.lotusNotesUser; | |||||
} | |||||
public String getPost() { | public String getPost() { | ||||
return this.post; | return this.post; | ||||
} | } | ||||
@@ -107,6 +102,12 @@ public class UserRecord { | |||||
public void setCustomerId(Integer customerId) { | public void setCustomerId(Integer customerId) { | ||||
this.customerId = customerId; | this.customerId = customerId; | ||||
} | } | ||||
public Integer getGroupId() { | |||||
return groupId; | |||||
} | |||||
public void setGroupId(Integer groupId) { | |||||
this.groupId = groupId; | |||||
} | |||||
public String getLocale() { | public String getLocale() { | ||||
return locale; | return locale; | ||||
} | } | ||||
@@ -170,19 +171,5 @@ public class UserRecord { | |||||
public String getRemarks() { | public String getRemarks() { | ||||
return remarks; | return remarks; | ||||
} | } | ||||
public void setLotusNotesUser(Boolean lotusNotesUser) { | |||||
this.lotusNotesUser = lotusNotesUser; | |||||
} | |||||
public Boolean getLotusNotesUser() { | |||||
return lotusNotesUser; | |||||
} | |||||
public String getSubDivision() { | |||||
return this.subDivision; | |||||
} | |||||
public void setSubDivision(String subDivision) { | |||||
this.subDivision = subDivision; | |||||
} | |||||
} | } |
@@ -6,14 +6,16 @@ import com.ffii.lioner.modules.user.entity.User; | |||||
public class LoadUserRes { | public class LoadUserRes { | ||||
private User data; | private User data; | ||||
private Integer groupId; | |||||
private List<Integer> authIds; | private List<Integer> authIds; | ||||
private List<Integer> groupIds; | private List<Integer> groupIds; | ||||
public LoadUserRes() { | public LoadUserRes() { | ||||
} | } | ||||
public LoadUserRes(User data, List<Integer> authIds, List<Integer> groupIds) { | |||||
public LoadUserRes(User data, Integer groupId, List<Integer> authIds, List<Integer> groupIds) { | |||||
this.data = data; | this.data = data; | ||||
this.groupId = groupId; | |||||
this.authIds = authIds; | this.authIds = authIds; | ||||
this.groupIds = groupIds; | this.groupIds = groupIds; | ||||
} | } | ||||
@@ -42,4 +44,12 @@ public class LoadUserRes { | |||||
this.groupIds = groupIds; | this.groupIds = groupIds; | ||||
} | } | ||||
public Integer getGroupId() { | |||||
return groupId; | |||||
} | |||||
public void setGroupId(Integer groupId) { | |||||
this.groupId = groupId; | |||||
} | |||||
} | } |
@@ -103,11 +103,12 @@ public class UserController { | |||||
@GetMapping("/{id}") | @GetMapping("/{id}") | ||||
@PreAuthorize("hasAuthority('MAINTAIN_USER')") | @PreAuthorize("hasAuthority('MAINTAIN_USER')") | ||||
public LoadUserRes load(@PathVariable long id) { | public LoadUserRes load(@PathVariable long id) { | ||||
LoadUserRes test = new LoadUserRes( | |||||
LoadUserRes userRes = new LoadUserRes( | |||||
userService.find(id).orElseThrow(NotFoundException::new), | userService.find(id).orElseThrow(NotFoundException::new), | ||||
userService.getUserGroupId(id), | |||||
userService.listUserAuthId(id), | userService.listUserAuthId(id), | ||||
userService.listUserGroupId(id)); | userService.listUserGroupId(id)); | ||||
return test; | |||||
return userRes; | |||||
} | } | ||||
// @Operation(summary = "delete user", responses = { @ApiResponse(responseCode = | // @Operation(summary = "delete user", responses = { @ApiResponse(responseCode = | ||||
@@ -288,22 +289,6 @@ public class UserController { | |||||
return new RecordsRes<>(temp); | return new RecordsRes<>(temp); | ||||
} | } | ||||
@GetMapping("/lotusCombo") | |||||
public ResponseEntity<?> lotusCombo(@RequestParam(defaultValue = "") String username) throws Exception { | |||||
AtomicInteger tempId = new AtomicInteger(0); | |||||
List<Map<String, Object>> searchUser = ldapTemplate.search("", "(&(objectClass=*)(cn=*" + username + "*))", | |||||
(AttributesMapper<Map<String, Object>>) (attrs -> { | |||||
Map<String, Object> user = new HashMap<>(); | |||||
user.put("id", tempId.getAndIncrement()); | |||||
user.put("label", attrs.get("cn").get().toString()); | |||||
user.put("key", attrs.get("cn").get().toString()); | |||||
user.put("mail", attrs.get("mail").get().toString()); | |||||
return user; | |||||
})); | |||||
return ResponseEntity.ok(Map.of("records",searchUser)); | |||||
} | |||||
@GetMapping("/checkDuplicate") | @GetMapping("/checkDuplicate") | ||||
public Map<String, Boolean> checkDuplicate(@RequestParam String name, Long id) { | public Map<String, Boolean> checkDuplicate(@RequestParam String name, Long id) { | ||||
boolean isNameTaken = userService.isNameTaken(name, id); | boolean isNameTaken = userService.isNameTaken(name, id); | ||||
@@ -311,20 +296,6 @@ public class UserController { | |||||
"isTaken", isNameTaken); | "isTaken", isNameTaken); | ||||
} | } | ||||
@GetMapping("/getReminderFlag/{id}") | |||||
public Map<String, Object> getReminderFlag(@PathVariable Long id) { | |||||
User user = userService.find(id).get(); | |||||
return Map.of("isReminder", user.getReminderFlag()); | |||||
} | |||||
@PostMapping("/setReminderFlag/{id}/{flag}") | |||||
@ResponseStatus(HttpStatus.NO_CONTENT) | |||||
public void setReminderFlag(@PathVariable Long id, @PathVariable Boolean flag) { | |||||
User user = userService.find(id).get(); | |||||
user.setReminderFlag(flag); | |||||
userService.save(user); | |||||
} | |||||
@GetMapping("/isPasswordExpired") | @GetMapping("/isPasswordExpired") | ||||
public Map<String, Boolean> getIsPasswordExpired(@RequestParam Long id) { | public Map<String, Boolean> getIsPasswordExpired(@RequestParam Long id) { | ||||
Integer maximumDay = settingsService.getInt(SettingNames.SYS_PASSWORD_RULE_DURATION); | Integer maximumDay = settingsService.getInt(SettingNames.SYS_PASSWORD_RULE_DURATION); | ||||