@@ -6,6 +6,7 @@ import app.module.core.config.application.enums.AppType;
|
|||||||
import app.module.core.config.application.util.MessageUtil;
|
import app.module.core.config.application.util.MessageUtil;
|
||||||
import app.module.core.usecase.admin.saveAdmin.ports.SaveAdminPortIn;
|
import app.module.core.usecase.admin.saveAdmin.ports.SaveAdminPortIn;
|
||||||
import app.module.core.usecase.role.list.ports.RoleListPortIn;
|
import app.module.core.usecase.role.list.ports.RoleListPortIn;
|
||||||
|
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
@@ -22,6 +23,7 @@ public class AdminCreatePostController {
|
|||||||
private final RoleListPortIn roleListPortIn;
|
private final RoleListPortIn roleListPortIn;
|
||||||
private final MessageUtil messageUtil;
|
private final MessageUtil messageUtil;
|
||||||
private final SaveAdminPortIn savePortIn;
|
private final SaveAdminPortIn savePortIn;
|
||||||
|
private final UICodeListPortIn uiCodeListPortIn;
|
||||||
private final AdminCreateValidator adminCreateValidator;
|
private final AdminCreateValidator adminCreateValidator;
|
||||||
|
|
||||||
@PostMapping(path = "/settings/admins/create")
|
@PostMapping(path = "/settings/admins/create")
|
||||||
@@ -34,6 +36,7 @@ public class AdminCreatePostController {
|
|||||||
adminCreateValidator.validate(bindingVO, bindingResult);
|
adminCreateValidator.validate(bindingVO, bindingResult);
|
||||||
if (bindingResult.hasErrors()) {
|
if (bindingResult.hasErrors()) {
|
||||||
model.addAttribute("roles", roleListPortIn.connect(AppType.ADMIN));
|
model.addAttribute("roles", roleListPortIn.connect(AppType.ADMIN));
|
||||||
|
model.addAttribute("regionMainCode", uiCodeListPortIn.connect("code.region.main"));
|
||||||
return "admin/adminCreateForm";
|
return "admin/adminCreateForm";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,6 +45,7 @@ public class AdminCreatePostController {
|
|||||||
bindingVO.getId(),
|
bindingVO.getId(),
|
||||||
bindingVO.getPassword(),
|
bindingVO.getPassword(),
|
||||||
bindingVO.getEmail(),
|
bindingVO.getEmail(),
|
||||||
|
bindingVO.getRegionMainCode(),
|
||||||
bindingVO.getAccountDisabled(),
|
bindingVO.getAccountDisabled(),
|
||||||
bindingVO.getAccountLocked(),
|
bindingVO.getAccountLocked(),
|
||||||
bindingVO.getRoleIds());
|
bindingVO.getRoleIds());
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import app.module.core.config.application.util.MessageUtil;
|
|||||||
import app.module.core.usecase.admin.view.ports.AdminViewPortIn;
|
import app.module.core.usecase.admin.view.ports.AdminViewPortIn;
|
||||||
import app.module.core.usecase.admin.view.ports.application.domain.AdminView;
|
import app.module.core.usecase.admin.view.ports.application.domain.AdminView;
|
||||||
import app.module.core.usecase.role.list.ports.RoleListPortIn;
|
import app.module.core.usecase.role.list.ports.RoleListPortIn;
|
||||||
|
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -24,6 +25,7 @@ class AdminUpdateGetController {
|
|||||||
|
|
||||||
private final AdminViewPortIn adminViewPortIn;
|
private final AdminViewPortIn adminViewPortIn;
|
||||||
private final RoleListPortIn roleListPortIn;
|
private final RoleListPortIn roleListPortIn;
|
||||||
|
private final UICodeListPortIn uiCodeListPortIn;
|
||||||
private final MessageUtil messageUtil;
|
private final MessageUtil messageUtil;
|
||||||
|
|
||||||
@GetMapping(path = "/settings/admins/update/{adminId}")
|
@GetMapping(path = "/settings/admins/update/{adminId}")
|
||||||
@@ -52,6 +54,7 @@ class AdminUpdateGetController {
|
|||||||
output.getId(),
|
output.getId(),
|
||||||
null,
|
null,
|
||||||
output.getEmail(),
|
output.getEmail(),
|
||||||
|
output.getRegionMainCode(),
|
||||||
output.getPasswordUpdatedAt(),
|
output.getPasswordUpdatedAt(),
|
||||||
output.getAccountDisabled(),
|
output.getAccountDisabled(),
|
||||||
output.getLoginFailCnt(),
|
output.getLoginFailCnt(),
|
||||||
@@ -60,6 +63,7 @@ class AdminUpdateGetController {
|
|||||||
|
|
||||||
model.addAttribute("bindingVO", bindingVO);
|
model.addAttribute("bindingVO", bindingVO);
|
||||||
model.addAttribute("roles", roleListPortIn.connect(AppType.ADMIN));
|
model.addAttribute("roles", roleListPortIn.connect(AppType.ADMIN));
|
||||||
|
model.addAttribute("regionMainCode", uiCodeListPortIn.connect("code.region.main"));
|
||||||
|
|
||||||
return "admin/adminUpdateForm";
|
return "admin/adminUpdateForm";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
package app.module.admin.usecase.admin.saveAdmin.adapters.web;
|
package app.module.admin.usecase.admin.saveAdmin.adapters.web;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.admin.getAdmins.adapters.web.model.AdminListFilterVO;
|
||||||
import app.module.admin.usecase.admin.saveAdmin.adapters.web.model.AdminUpdateBindingVO;
|
import app.module.admin.usecase.admin.saveAdmin.adapters.web.model.AdminUpdateBindingVO;
|
||||||
import app.module.admin.usecase.admin.saveAdmin.adapters.web.validator.AdminUpdateValidator;
|
import app.module.admin.usecase.admin.saveAdmin.adapters.web.validator.AdminUpdateValidator;
|
||||||
import app.module.core.config.application.enums.AppType;
|
import app.module.core.config.application.enums.AppType;
|
||||||
import app.module.core.config.application.util.MessageUtil;
|
import app.module.core.config.application.util.MessageUtil;
|
||||||
import app.module.core.usecase.admin.saveAdmin.ports.SaveAdminPortIn;
|
import app.module.core.usecase.admin.saveAdmin.ports.SaveAdminPortIn;
|
||||||
import app.module.core.usecase.role.list.ports.RoleListPortIn;
|
import app.module.core.usecase.role.list.ports.RoleListPortIn;
|
||||||
|
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
@@ -21,6 +23,7 @@ class AdminUpdatePostController {
|
|||||||
|
|
||||||
private final AdminUpdateValidator adminUpdateValidator;
|
private final AdminUpdateValidator adminUpdateValidator;
|
||||||
private final RoleListPortIn roleListPortIn;
|
private final RoleListPortIn roleListPortIn;
|
||||||
|
private final UICodeListPortIn uiCodeListPortIn;
|
||||||
private final SaveAdminPortIn saveAdminPortIn;
|
private final SaveAdminPortIn saveAdminPortIn;
|
||||||
private final MessageUtil messageUtil;
|
private final MessageUtil messageUtil;
|
||||||
|
|
||||||
@@ -34,6 +37,7 @@ class AdminUpdatePostController {
|
|||||||
adminUpdateValidator.validate(bindingVO, bindingResult);
|
adminUpdateValidator.validate(bindingVO, bindingResult);
|
||||||
if (bindingResult.hasErrors()) {
|
if (bindingResult.hasErrors()) {
|
||||||
model.addAttribute("roles", roleListPortIn.connect(AppType.ADMIN));
|
model.addAttribute("roles", roleListPortIn.connect(AppType.ADMIN));
|
||||||
|
model.addAttribute("regionMainCode", uiCodeListPortIn.connect("code.region.main"));
|
||||||
return "admin/adminUpdateForm";
|
return "admin/adminUpdateForm";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,6 +46,7 @@ class AdminUpdatePostController {
|
|||||||
bindingVO.getId(),
|
bindingVO.getId(),
|
||||||
bindingVO.getUpdatePassword(),
|
bindingVO.getUpdatePassword(),
|
||||||
bindingVO.getEmail(),
|
bindingVO.getEmail(),
|
||||||
|
bindingVO.getRegionMainCode(),
|
||||||
bindingVO.getAccountDisabled(),
|
bindingVO.getAccountDisabled(),
|
||||||
bindingVO.getAccountLocked(),
|
bindingVO.getAccountLocked(),
|
||||||
bindingVO.getRoleIds());
|
bindingVO.getRoleIds());
|
||||||
|
|||||||
@@ -21,9 +21,9 @@ public class AdminCreateBindingVO {
|
|||||||
"^[\\w!#$%&’*+/=?`{|}~^-]+(?:\\.[\\w!#$%&’*+/=?`{|}~^-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,6}$",
|
"^[\\w!#$%&’*+/=?`{|}~^-]+(?:\\.[\\w!#$%&’*+/=?`{|}~^-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,6}$",
|
||||||
message = "{valid.common.email.wrong}")
|
message = "{valid.common.email.wrong}")
|
||||||
private String email;
|
private String email;
|
||||||
private String regionMainCode;
|
|
||||||
|
|
||||||
private Boolean accountDisabled;
|
private Boolean accountDisabled;
|
||||||
private Boolean accountLocked;
|
private Boolean accountLocked;
|
||||||
private List<String> roleIds;
|
private List<String> roleIds;
|
||||||
|
private String regionMainCode;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ public class AdminUpdateBindingVO implements AuditOutput {
|
|||||||
"^[\\w!#$%&’*+/=?`{|}~^-]+(?:\\.[\\w!#$%&’*+/=?`{|}~^-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,6}$",
|
"^[\\w!#$%&’*+/=?`{|}~^-]+(?:\\.[\\w!#$%&’*+/=?`{|}~^-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,6}$",
|
||||||
message = "{valid.common.email.wrong}")
|
message = "{valid.common.email.wrong}")
|
||||||
private String email;
|
private String email;
|
||||||
|
private String regionMainCode;
|
||||||
|
|
||||||
private LocalDateTime passwordUpdatedAt;
|
private LocalDateTime passwordUpdatedAt;
|
||||||
private Boolean accountDisabled;
|
private Boolean accountDisabled;
|
||||||
|
|||||||
@@ -33,5 +33,14 @@ public class AdminCreateValidator implements Validator {
|
|||||||
ids ->
|
ids ->
|
||||||
errors.rejectValue(
|
errors.rejectValue(
|
||||||
"roleIds", "valid.common.required.size.min", new Object[]{1}, ""));
|
"roleIds", "valid.common.required.size.min", new Object[]{1}, ""));
|
||||||
|
|
||||||
|
// ROLE_ADMIN이 아닌 경우 regionMainCode null체크
|
||||||
|
Optional.ofNullable(vo.getRoleIds())
|
||||||
|
.filter(ids -> ids.stream().noneMatch(role -> role.equals("ROLE_ADMIN")))
|
||||||
|
.ifPresent(nonAdmins -> {
|
||||||
|
if (vo.getRegionMainCode() == null || vo.getRegionMainCode().isBlank()) {
|
||||||
|
errors.rejectValue("regionMainCode", "valid.common.required");
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,5 +30,14 @@ public class AdminUpdateValidator implements Validator {
|
|||||||
Optional.ofNullable(vo.getUpdatePassword())
|
Optional.ofNullable(vo.getUpdatePassword())
|
||||||
.filter(s -> !s.trim().isEmpty() && !s.matches(PASSWORD_REGEX))
|
.filter(s -> !s.trim().isEmpty() && !s.matches(PASSWORD_REGEX))
|
||||||
.ifPresent(s -> errors.rejectValue("updatePassword", "valid.common.password.wrong"));
|
.ifPresent(s -> errors.rejectValue("updatePassword", "valid.common.password.wrong"));
|
||||||
|
|
||||||
|
// ROLE_ADMIN이 아닌 경우 regionMainCode null체크
|
||||||
|
Optional.ofNullable(vo.getRoleIds())
|
||||||
|
.filter(ids -> ids.stream().noneMatch(role -> role.equals("ROLE_ADMIN")))
|
||||||
|
.ifPresent(nonAdmins -> {
|
||||||
|
if (vo.getRegionMainCode() == null || vo.getRegionMainCode().isBlank()) {
|
||||||
|
errors.rejectValue("regionMainCode", "valid.common.required");
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,13 +9,14 @@
|
|||||||
th:action="@{/settings/admins/create}"
|
th:action="@{/settings/admins/create}"
|
||||||
th:object="${bindingVO}">
|
th:object="${bindingVO}">
|
||||||
|
|
||||||
|
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<label class="col-sm-2 col-form-label" for="id">ID *</label>
|
<label class="col-sm-2 col-form-label" for="id">ID *</label>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<input class="form-control" id="id" th:classappend="${#fields.hasErrors('id')} ? 'is-invalid'"
|
<input class="form-control" id="id"
|
||||||
|
th:classappend="${#fields.hasErrors('id')} ? 'is-invalid'"
|
||||||
th:field="*{id}"/>
|
th:field="*{id}"/>
|
||||||
<div class="invalid-feedback fw-bold" th:errors="*{id}" th:if="${#fields.hasErrors('id')}">
|
<div class="invalid-feedback fw-bold" th:errors="*{id}"
|
||||||
|
th:if="${#fields.hasErrors('id')}">
|
||||||
에러 메세지
|
에러 메세지
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -25,7 +26,9 @@
|
|||||||
<label class="col-sm-2 col-form-label" for="password">Password *</label>
|
<label class="col-sm-2 col-form-label" for="password">Password *</label>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
|
|
||||||
<input class="form-control" id="password" th:classappend="${#fields.hasErrors('password')} ? 'is-invalid'" th:field="*{password}"
|
<input class="form-control" id="password"
|
||||||
|
th:classappend="${#fields.hasErrors('password')} ? 'is-invalid'"
|
||||||
|
th:field="*{password}"
|
||||||
type="password"/>
|
type="password"/>
|
||||||
<div class="invalid-feedback fw-bold" th:errors="*{password}"
|
<div class="invalid-feedback fw-bold" th:errors="*{password}"
|
||||||
th:if="${#fields.hasErrors('password')}">
|
th:if="${#fields.hasErrors('password')}">
|
||||||
@@ -38,7 +41,9 @@
|
|||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<label class="col-sm-2 col-form-label" for="email">Email *</label>
|
<label class="col-sm-2 col-form-label" for="email">Email *</label>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<input class="form-control" id="email" th:classappend="${#fields.hasErrors('email')} ? 'is-invalid'" th:field="*{email}"
|
<input class="form-control" id="email"
|
||||||
|
th:classappend="${#fields.hasErrors('email')} ? 'is-invalid'"
|
||||||
|
th:field="*{email}"
|
||||||
type="email"/>
|
type="email"/>
|
||||||
<div class="invalid-feedback fw-bold" th:errors="*{email}"
|
<div class="invalid-feedback fw-bold" th:errors="*{email}"
|
||||||
th:if="${#fields.hasErrors('email')}">
|
th:if="${#fields.hasErrors('email')}">
|
||||||
@@ -50,7 +55,8 @@
|
|||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<label class="col-sm-2 col-form-label" for="roleIds">권한 *</label>
|
<label class="col-sm-2 col-form-label" for="roleIds">권한 *</label>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<select class="form-control" id="roleIds" multiple th:classappend="${#fields.hasErrors('roleIds')} ? 'is-invalid'"
|
<select class="form-control" id="roleIds" multiple
|
||||||
|
th:classappend="${#fields.hasErrors('roleIds')} ? 'is-invalid'"
|
||||||
th:field="*{roleIds}"
|
th:field="*{roleIds}"
|
||||||
onchange="onRoleChange(this);">
|
onchange="onRoleChange(this);">
|
||||||
<option th:each="role : ${roles}" th:text="${role.id}"
|
<option th:each="role : ${roles}" th:text="${role.id}"
|
||||||
@@ -64,9 +70,10 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row mb-3 regionMainCodeArea" style="display: none;">
|
<div class="row mb-3 regionMainCodeArea" style="display: none;">
|
||||||
<label class="col-sm-2 col-form-label" for="regionMainCode">실사</label>
|
<label class="col-sm-2 col-form-label" for="regionMainCode">실사 *</label>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<select class="form-select" id="regionMainCode" name="regionMainCode" th:field="*{regionMainCode}">
|
<select class="form-select" id="regionMainCode" name="regionMainCode"
|
||||||
|
th:field="*{regionMainCode}">
|
||||||
<option value="">선택</option>
|
<option value="">선택</option>
|
||||||
<option th:each="code : ${regionMainCode}"
|
<option th:each="code : ${regionMainCode}"
|
||||||
th:value="${code.id}"
|
th:value="${code.id}"
|
||||||
@@ -119,7 +126,8 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button class="btn btn-primary float-end" type="submit">저장</button>
|
<button class="btn btn-primary float-end" type="submit">저장</button>
|
||||||
<button class="btn btn-light" onclick="gotoList();return false;" type="button">목록으로 이동</button>
|
<button class="btn btn-light" onclick="gotoList();return false;" type="button">목록으로 이동
|
||||||
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|||||||
@@ -16,13 +16,15 @@
|
|||||||
<div class="row p-2 mb-2 border-secondary border-top border-bottom border-1">
|
<div class="row p-2 mb-2 border-secondary border-top border-bottom border-1">
|
||||||
<div class="col-5">
|
<div class="col-5">
|
||||||
<label class="col-sm-2 col-form-label" for="searchField">검색필드</label>
|
<label class="col-sm-2 col-form-label" for="searchField">검색필드</label>
|
||||||
<select class="form-select d-inline w-25" id="searchField" th:field="*{searchField}">
|
<select class="form-select d-inline w-25" id="searchField"
|
||||||
|
th:field="*{searchField}">
|
||||||
<option selected value="">선택</option>
|
<option selected value="">선택</option>
|
||||||
<option value="id">ID</option>
|
<option value="id">ID</option>
|
||||||
<option value="email">Email</option>
|
<option value="email">Email</option>
|
||||||
</select>
|
</select>
|
||||||
<label>
|
<label>
|
||||||
<input class="form-control d-inline" placeholder="검색어를 입력하세요." style="width: 250px;"
|
<input class="form-control d-inline" placeholder="검색어를 입력하세요."
|
||||||
|
style="width: 250px;"
|
||||||
th:field="*{searchValue}" type="text">
|
th:field="*{searchValue}" type="text">
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
@@ -57,7 +59,8 @@
|
|||||||
onchange="goSearch()">
|
onchange="goSearch()">
|
||||||
<option
|
<option
|
||||||
th:each="item : ${pageRows}"
|
th:each="item : ${pageRows}"
|
||||||
th:selected="${#strings.toString(listOutput.pageable.pageSize) eq item.codeValue}" th:text="${item.codeText}"
|
th:selected="${#strings.toString(listOutput.pageable.pageSize) eq item.codeValue}"
|
||||||
|
th:text="${item.codeText}"
|
||||||
th:value="${item.codeValue}"></option>
|
th:value="${item.codeValue}"></option>
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
@@ -69,16 +72,22 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th scope="col">#</th>
|
<th scope="col">#</th>
|
||||||
<th scope="col">
|
<th scope="col">
|
||||||
<label><input class="form-check-input" onchange="toggleCheckbox(this);" type="checkbox"/></label>
|
<label><input class="form-check-input" onchange="toggleCheckbox(this);"
|
||||||
|
type="checkbox"/></label>
|
||||||
</th>
|
</th>
|
||||||
<th scope="col"><a class="order-able" data-sort-field="id" href="#">ID</a></th>
|
<th scope="col"><a class="order-able" data-sort-field="id" href="#">ID</a></th>
|
||||||
<th class="text-secondary" scope="col">권한</th>
|
<th class="text-secondary" scope="col">권한</th>
|
||||||
<th scope="col"><a class="order-able" data-sort-field="email" href="#">Email</a></th>
|
<th scope="col"><a class="order-able" data-sort-field="email" href="#">Email</a>
|
||||||
<th scope="col"><a class="order-able" data-sort-field="accountDisabled" href="#">활성화</a>
|
</th>
|
||||||
|
<th scope="col"><a class="order-able" data-sort-field="accountDisabled"
|
||||||
|
href="#">활성화</a>
|
||||||
|
</th>
|
||||||
|
<th scope="col"><a class="order-able" data-sort-field="accountLocked"
|
||||||
|
href="#">계정잠김</a></th>
|
||||||
|
<th scope="col"><a class="order-able" data-sort-field="createdAt" href="#">등록일</a>
|
||||||
|
</th>
|
||||||
|
<th scope="col"><a class="order-able" data-sort-field="updatedAt" href="#">수정일</a>
|
||||||
</th>
|
</th>
|
||||||
<th scope="col"><a class="order-able" data-sort-field="accountLocked" href="#">계정잠김</a></th>
|
|
||||||
<th scope="col"><a class="order-able" data-sort-field="createdAt" href="#">등록일</a></th>
|
|
||||||
<th scope="col"><a class="order-able" data-sort-field="updatedAt" href="#">수정일</a></th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -90,7 +99,8 @@
|
|||||||
<td><label><input class="form-check-input" name="checkedIds" th:value="${item.id}"
|
<td><label><input class="form-check-input" name="checkedIds" th:value="${item.id}"
|
||||||
type="checkbox"/></label>
|
type="checkbox"/></label>
|
||||||
</td>
|
</td>
|
||||||
<td><a th:href="|javascript:goUpdate('${item.id}')|" th:text="${item.id}">아이디</a></td>
|
<td><a th:href="|javascript:goUpdate('${item.id}')|" th:text="${item.id}">아이디</a>
|
||||||
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<span th:each="role, status : ${item.roles}"
|
<span th:each="role, status : ${item.roles}"
|
||||||
th:text="${role.getId()} + ${!status.last ? ', ': ''}"></span>
|
th:text="${role.getId()} + ${!status.last ? ', ': ''}"></span>
|
||||||
|
|||||||
@@ -36,7 +36,9 @@
|
|||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<label class="col-sm-2 col-form-label" for="email">Email *</label>
|
<label class="col-sm-2 col-form-label" for="email">Email *</label>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<input class="form-control" id="email" th:classappend="${#fields.hasErrors('email')} ? 'is-invalid'" th:field="*{email}"
|
<input class="form-control" id="email"
|
||||||
|
th:classappend="${#fields.hasErrors('email')} ? 'is-invalid'"
|
||||||
|
th:field="*{email}"
|
||||||
type="email"/>
|
type="email"/>
|
||||||
<div class="invalid-feedback fw-bold" th:errors="*{email}"
|
<div class="invalid-feedback fw-bold" th:errors="*{email}"
|
||||||
th:if="${#fields.hasErrors('email')}">
|
th:if="${#fields.hasErrors('email')}">
|
||||||
@@ -48,8 +50,10 @@
|
|||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<label class="col-sm-2 col-form-label" for="roleIds">권한 *</label>
|
<label class="col-sm-2 col-form-label" for="roleIds">권한 *</label>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
<select class="form-control" id="roleIds" multiple th:classappend="${#fields.hasErrors('roleIds')} ? 'is-invalid'"
|
<select class="form-control" id="roleIds" multiple
|
||||||
th:field="*{roleIds}">
|
th:classappend="${#fields.hasErrors('roleIds')} ? 'is-invalid'"
|
||||||
|
th:field="*{roleIds}"
|
||||||
|
onchange="onRoleChange(this);">
|
||||||
<option th:each="role : ${roles}" th:text="${role.id}"
|
<option th:each="role : ${roles}" th:text="${role.id}"
|
||||||
th:value="${role.id}"></option>
|
th:value="${role.id}"></option>
|
||||||
</select>
|
</select>
|
||||||
@@ -60,6 +64,26 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row mb-3 regionMainCodeArea"
|
||||||
|
th:style="${#lists.contains(bindingVO.roleIds, 'ROLE_ADMIN')} ? 'display: none;' : 'display: flex;'">
|
||||||
|
<label class="col-sm-2 col-form-label" for="regionMainCode">실사 *</label>
|
||||||
|
<div class="col-sm-4">
|
||||||
|
<select class="form-select" id="regionMainCode" name="regionMainCode"
|
||||||
|
th:classappend="${#fields.hasErrors('regionMainCode')} ? 'is-invalid'"
|
||||||
|
th:field="*{regionMainCode}">
|
||||||
|
<option value="">선택</option>
|
||||||
|
<option th:each="code : ${regionMainCode}"
|
||||||
|
th:value="${code.id}"
|
||||||
|
th:text="${code.codeText}">
|
||||||
|
</option>
|
||||||
|
</select>
|
||||||
|
<div class="invalid-feedback fw-bold" th:errors="*{regionMainCode}"
|
||||||
|
th:if="${#fields.hasErrors('regionMainCode')}">
|
||||||
|
에러 메세지
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<!-- 활성화 -->
|
<!-- 활성화 -->
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<label class="col-sm-2 col-form-label" for="inlineRadio1">비활성화 여부 *</label>
|
<label class="col-sm-2 col-form-label" for="inlineRadio1">비활성화 여부 *</label>
|
||||||
@@ -108,10 +132,12 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button class="btn btn-primary float-end" type="submit">저장</button>
|
<button class="btn btn-primary float-end" type="submit">저장</button>
|
||||||
<button class="btn btn-light" onclick="gotoList();return false;" type="button">목록으로 이동</button>
|
<button class="btn btn-light" onclick="gotoList();return false;" type="button">목록으로 이동
|
||||||
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<!-- 이전 목록페이지의 검색 및 정렬조건 폼 -->
|
<!-- 이전 목록페이지의 검색 및 정렬조건 폼 -->
|
||||||
|
<th:block th:if="${listStatus != null}">
|
||||||
<form method="get" name="prevAdminParamForm"
|
<form method="get" name="prevAdminParamForm"
|
||||||
th:action="@{/settings/admins}"
|
th:action="@{/settings/admins}"
|
||||||
th:object="${listStatus}">
|
th:object="${listStatus}">
|
||||||
@@ -123,11 +149,12 @@
|
|||||||
<input name="sort" th:value="${pageable.sort}" type="hidden"/>
|
<input name="sort" th:value="${pageable.sort}" type="hidden"/>
|
||||||
</th:block>
|
</th:block>
|
||||||
</form>
|
</form>
|
||||||
|
</th:block>
|
||||||
|
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
function gotoList() {
|
function gotoList() {
|
||||||
if (document.prevParamForm) {
|
if (document.prevAdminParamForm) {
|
||||||
const f = document.prevParamForm;
|
const f = document.prevAdminParamForm;
|
||||||
f.sort.value = convertToPageableSortValue(f.sort.value);
|
f.sort.value = convertToPageableSortValue(f.sort.value);
|
||||||
f.submit();
|
f.submit();
|
||||||
} else {
|
} else {
|
||||||
@@ -143,6 +170,12 @@
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const onRoleChange = (el) => {
|
||||||
|
$('.regionMainCodeArea').toggle(el.value !== "ROLE_ADMIN");
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ class AdminAuthFailHandlerTest {
|
|||||||
testUsername,
|
testUsername,
|
||||||
"test.1@#$",
|
"test.1@#$",
|
||||||
"xx4@test.com",
|
"xx4@test.com",
|
||||||
|
null,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
Arrays.asList("ROLE_SUPER", "ROLE_STAFF"));
|
Arrays.asList("ROLE_SUPER", "ROLE_STAFF"));
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ class AdminDetailsServiceTest {
|
|||||||
username,
|
username,
|
||||||
password,
|
password,
|
||||||
"xx1@test.com",
|
"xx1@test.com",
|
||||||
|
null,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
Arrays.asList("ROLE_SUPER", "ROLE_STAFF"));
|
Arrays.asList("ROLE_SUPER", "ROLE_STAFF"));
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ class AdminCreateUpdateDaoTest {
|
|||||||
"admin_for_createDao_test",
|
"admin_for_createDao_test",
|
||||||
"test.1@#$",
|
"test.1@#$",
|
||||||
"admin_for_createDao_test@test.com",
|
"admin_for_createDao_test@test.com",
|
||||||
|
null,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
Arrays.asList("ROLE_SUPER", "ROLE_STAFF"));
|
Arrays.asList("ROLE_SUPER", "ROLE_STAFF"));
|
||||||
@@ -56,6 +57,7 @@ class AdminCreateUpdateDaoTest {
|
|||||||
"admin_for_createDao_test",
|
"admin_for_createDao_test",
|
||||||
"test.1@#$",
|
"test.1@#$",
|
||||||
"admin_for_createDao_test@test.com",
|
"admin_for_createDao_test@test.com",
|
||||||
|
null,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
List.of("ROLE_STAFF"));
|
List.of("ROLE_STAFF"));
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ class CreateAdminController {
|
|||||||
reqVO.getId(),
|
reqVO.getId(),
|
||||||
reqVO.getPassword(),
|
reqVO.getPassword(),
|
||||||
reqVO.getEmail(),
|
reqVO.getEmail(),
|
||||||
|
reqVO.getRegionMainCode(),
|
||||||
reqVO.getAccountDisabled(),
|
reqVO.getAccountDisabled(),
|
||||||
reqVO.getAccountLocked(),
|
reqVO.getAccountLocked(),
|
||||||
reqVO.getRoleIds());
|
reqVO.getRoleIds());
|
||||||
|
|||||||
@@ -28,6 +28,9 @@ public class CreateAdminReqVO {
|
|||||||
@Schema(description = "email", example = "admin-email@email.com")
|
@Schema(description = "email", example = "admin-email@email.com")
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
|
@Schema(description = "실사지역코드", example = "code.region.main.1")
|
||||||
|
private String regionMainCode;
|
||||||
|
|
||||||
@Schema(description = "계정 비활성화", example = "false")
|
@Schema(description = "계정 비활성화", example = "false")
|
||||||
private Boolean accountDisabled;
|
private Boolean accountDisabled;
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ class UpdateAdminController {
|
|||||||
reqVO.getId(),
|
reqVO.getId(),
|
||||||
reqVO.getUpdatePassword(),
|
reqVO.getUpdatePassword(),
|
||||||
reqVO.getEmail(),
|
reqVO.getEmail(),
|
||||||
|
reqVO.getRegionMainCode(),
|
||||||
reqVO.getAccountDisabled(),
|
reqVO.getAccountDisabled(),
|
||||||
reqVO.getAccountLocked(),
|
reqVO.getAccountLocked(),
|
||||||
reqVO.getRoleIds());
|
reqVO.getRoleIds());
|
||||||
|
|||||||
@@ -35,6 +35,9 @@ public class UpdateAdminReqVO {
|
|||||||
@Schema(description = "email", example = "staff@new-staff.com")
|
@Schema(description = "email", example = "staff@new-staff.com")
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
|
@Schema(description = "실사지역코드", example = "code.region.main.1")
|
||||||
|
private String regionMainCode;
|
||||||
|
|
||||||
@Schema(description = "계정 비활성화 여부", example = "false")
|
@Schema(description = "계정 비활성화 여부", example = "false")
|
||||||
private Boolean accountDisabled;
|
private Boolean accountDisabled;
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ public class InitAdminData implements ApplicationRunner {
|
|||||||
"test-admin",
|
"test-admin",
|
||||||
"admin1@#$",
|
"admin1@#$",
|
||||||
"admin@framework.org",
|
"admin@framework.org",
|
||||||
|
null,
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
List.of("ROLE_ADMIN"));
|
List.of("ROLE_ADMIN"));
|
||||||
@@ -43,6 +44,7 @@ public class InitAdminData implements ApplicationRunner {
|
|||||||
"test-analyst",
|
"test-analyst",
|
||||||
"analyst1@#$",
|
"analyst1@#$",
|
||||||
"analyst@framework.org",
|
"analyst@framework.org",
|
||||||
|
"code.region.main.1",
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
List.of("ROLE_ANALYST"));
|
List.of("ROLE_ANALYST"));
|
||||||
@@ -53,6 +55,7 @@ public class InitAdminData implements ApplicationRunner {
|
|||||||
"test-researcher",
|
"test-researcher",
|
||||||
"researcher1@#$",
|
"researcher1@#$",
|
||||||
"researcher@framework.org",
|
"researcher@framework.org",
|
||||||
|
"code.region.main.1",
|
||||||
false,
|
false,
|
||||||
false,
|
false,
|
||||||
List.of("ROLE_RESEARCHER"));
|
List.of("ROLE_RESEARCHER"));
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ public interface SaveAdminPortIn {
|
|||||||
String id,
|
String id,
|
||||||
String password,
|
String password,
|
||||||
String email,
|
String email,
|
||||||
|
String regionMainCode,
|
||||||
Boolean accountDisabled,
|
Boolean accountDisabled,
|
||||||
Boolean accountLocked,
|
Boolean accountLocked,
|
||||||
List<String> roleIds);
|
List<String> roleIds);
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ public class SaveAdminService implements SaveAdminPortIn {
|
|||||||
String id,
|
String id,
|
||||||
String password,
|
String password,
|
||||||
String email,
|
String email,
|
||||||
|
String regionMainCode,
|
||||||
Boolean accountDisabled,
|
Boolean accountDisabled,
|
||||||
Boolean accountLocked,
|
Boolean accountLocked,
|
||||||
List<String> roleIds) {
|
List<String> roleIds) {
|
||||||
@@ -58,6 +59,7 @@ public class SaveAdminService implements SaveAdminPortIn {
|
|||||||
password,
|
password,
|
||||||
passwordUpdatedAt,
|
passwordUpdatedAt,
|
||||||
email,
|
email,
|
||||||
|
regionMainCode,
|
||||||
accountDisabled,
|
accountDisabled,
|
||||||
loginFailCnt,
|
loginFailCnt,
|
||||||
accountLocked,
|
accountLocked,
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ public class SaveAdminCmd extends AuditCommand {
|
|||||||
private String encodedPassword;
|
private String encodedPassword;
|
||||||
private LocalDateTime passwordUpdatedAt;
|
private LocalDateTime passwordUpdatedAt;
|
||||||
private String email;
|
private String email;
|
||||||
|
private String regionMainCode;
|
||||||
private Boolean accountDisabled;
|
private Boolean accountDisabled;
|
||||||
private Integer loginFailCnt;
|
private Integer loginFailCnt;
|
||||||
private Boolean accountLocked;
|
private Boolean accountLocked;
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ public class AdminView implements Serializable {
|
|||||||
private String email;
|
private String email;
|
||||||
private String name;
|
private String name;
|
||||||
private String contact;
|
private String contact;
|
||||||
|
private String regionMainCode;
|
||||||
private Integer inspectionArea;
|
private Integer inspectionArea;
|
||||||
private LocalDateTime passwordUpdatedAt;
|
private LocalDateTime passwordUpdatedAt;
|
||||||
private Boolean accountDisabled;
|
private Boolean accountDisabled;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
a.email,
|
a.email,
|
||||||
a.name,
|
a.name,
|
||||||
a.contact,
|
a.contact,
|
||||||
a.inspection_area,
|
a.region_main_code,
|
||||||
a.password_updated_at,
|
a.password_updated_at,
|
||||||
a.account_disabled,
|
a.account_disabled,
|
||||||
a.login_fail_cnt,
|
a.login_fail_cnt,
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
id,
|
id,
|
||||||
password,
|
password,
|
||||||
email,
|
email,
|
||||||
|
region_main_code,
|
||||||
password_updated_at,
|
password_updated_at,
|
||||||
account_disabled,
|
account_disabled,
|
||||||
login_fail_cnt,
|
login_fail_cnt,
|
||||||
@@ -22,6 +23,7 @@
|
|||||||
#{id},
|
#{id},
|
||||||
#{encodedPassword},
|
#{encodedPassword},
|
||||||
#{email},
|
#{email},
|
||||||
|
#{regionMainCode},
|
||||||
#{passwordUpdatedAt},
|
#{passwordUpdatedAt},
|
||||||
#{accountDisabled},
|
#{accountDisabled},
|
||||||
#{loginFailCnt},
|
#{loginFailCnt},
|
||||||
@@ -35,6 +37,7 @@
|
|||||||
SET
|
SET
|
||||||
password = #{encodedPassword},
|
password = #{encodedPassword},
|
||||||
email = #{email},
|
email = #{email},
|
||||||
|
region_main_code = #{regionMainCode},
|
||||||
password_updated_at = #{passwordUpdatedAt},
|
password_updated_at = #{passwordUpdatedAt},
|
||||||
account_disabled = #{accountDisabled},
|
account_disabled = #{accountDisabled},
|
||||||
login_fail_cnt = #{loginFailCnt},
|
login_fail_cnt = #{loginFailCnt},
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ CREATE TABLE admin (
|
|||||||
password_updated_at timestamp(6) NOT NULL, -- 비밀번호 수정일
|
password_updated_at timestamp(6) NOT NULL, -- 비밀번호 수정일
|
||||||
name varchar(4), -- 관리자 이름
|
name varchar(4), -- 관리자 이름
|
||||||
contact varchar(15), -- 연락처
|
contact varchar(15), -- 연락처
|
||||||
inspection_area varchar(10), -- 실사지역
|
region_main_code varchar(255), -- 실사(공통코드)
|
||||||
account_disabled boolean, -- 계정 비활성화 여부
|
account_disabled boolean, -- 계정 비활성화 여부
|
||||||
login_fail_cnt integer, -- 로그인 실패 횟수
|
login_fail_cnt integer, -- 로그인 실패 횟수
|
||||||
account_locked boolean, -- 계정 잠김 여부
|
account_locked boolean, -- 계정 잠김 여부
|
||||||
@@ -211,7 +211,7 @@ COMMENT ON COLUMN admin.password IS '비밀번호';
|
|||||||
COMMENT ON COLUMN admin.password_updated_at IS '비밀번호 수정일';
|
COMMENT ON COLUMN admin.password_updated_at IS '비밀번호 수정일';
|
||||||
COMMENT ON COLUMN admin.name IS '관리자 이름';
|
COMMENT ON COLUMN admin.name IS '관리자 이름';
|
||||||
COMMENT ON COLUMN admin.contact IS '연락처';
|
COMMENT ON COLUMN admin.contact IS '연락처';
|
||||||
COMMENT ON COLUMN admin.inspection_area IS '실사지역';
|
COMMENT ON COLUMN admin.region_main_code IS '실사';
|
||||||
COMMENT ON COLUMN admin.account_disabled IS '계정 비활성화 여부';
|
COMMENT ON COLUMN admin.account_disabled IS '계정 비활성화 여부';
|
||||||
COMMENT ON COLUMN admin.login_fail_cnt IS '로그인 실패 횟수';
|
COMMENT ON COLUMN admin.login_fail_cnt IS '로그인 실패 횟수';
|
||||||
COMMENT ON COLUMN admin.account_locked IS '계정 잠김 여부';
|
COMMENT ON COLUMN admin.account_locked IS '계정 잠김 여부';
|
||||||
|
|||||||
Reference in New Issue
Block a user