@@ -43,6 +43,25 @@ public class PermissionService {
|
||||
return permissionMapper.findPermissionViews();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void createRole(String roleName, String description) {
|
||||
if (roleName == null || roleName.isBlank()) {
|
||||
throw new AppException("역할명은 필수입니다.");
|
||||
}
|
||||
long roleId = permissionMapper.nextRoleId();
|
||||
permissionMapper.insertRole(roleId, roleName.trim(), description);
|
||||
auditService.record(new AuditEvent("ROLE_CREATED", null, null, "SUCCESS", null, null, roleName));
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void deleteRole(long roleId) {
|
||||
int deleted = permissionMapper.deleteRole(roleId);
|
||||
if (deleted == 0) {
|
||||
throw new AppException("삭제할 역할을 찾을 수 없습니다.");
|
||||
}
|
||||
auditService.record(new AuditEvent("ROLE_DELETED", null, null, "SUCCESS", null, null, "roleId=" + roleId));
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public PermissionSet savePermissionSet(PermissionSetCommand command) {
|
||||
if (!"SELECT".equalsIgnoreCase(command.action())) {
|
||||
|
||||
Reference in New Issue
Block a user