[Developer] #617 apply DDS MCP end-user authorization

This commit is contained in:
devmrko
2026-07-02 09:34:58 +09:00
parent fd09622c82
commit ef1331be4b
53 changed files with 2040 additions and 337 deletions

View File

@@ -6,6 +6,7 @@ import com.cloudhandson.vpdbackoffice.domain.user.UserCreateCommand;
import com.cloudhandson.vpdbackoffice.domain.user.UserRoleView;
import com.cloudhandson.vpdbackoffice.mapper.UserMapper;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -14,10 +15,21 @@ public class UserService {
private final UserMapper userMapper;
private final AuditService auditService;
private final DdsAuthorizationChangeNotifier ddsAuthorizationChangeNotifier;
public UserService(UserMapper userMapper, AuditService auditService) {
@Autowired
public UserService(
UserMapper userMapper,
AuditService auditService,
DdsAuthorizationChangeNotifier ddsAuthorizationChangeNotifier
) {
this.userMapper = userMapper;
this.auditService = auditService;
this.ddsAuthorizationChangeNotifier = ddsAuthorizationChangeNotifier;
}
public UserService(UserMapper userMapper, AuditService auditService) {
this(userMapper, auditService, DdsAuthorizationChangeNotifier.noop());
}
public List<AppUser> findAll() {
@@ -33,6 +45,7 @@ public class UserService {
long userId = userMapper.nextUserId();
userMapper.insertUser(userId, command);
auditService.record(new AuditEvent("USER_CREATED", null, null, "SUCCESS", null, null, command.username()));
ddsAuthorizationChangeNotifier.changed("USER_CREATED");
}
@Transactional
@@ -43,6 +56,7 @@ public class UserService {
}
auditService.record(new AuditEvent("USER_ACTIVE_CHANGED", null, null, "SUCCESS", null, null,
"userId=" + userId + ",active=" + active));
ddsAuthorizationChangeNotifier.changed("USER_ACTIVE_CHANGED");
}
@Transactional
@@ -50,6 +64,7 @@ public class UserService {
userMapper.insertUserRole(userId, roleId);
auditService.record(new AuditEvent("USER_ROLE_GRANTED", null, null, "SUCCESS", null, null,
"userId=" + userId + ",roleId=" + roleId));
ddsAuthorizationChangeNotifier.changed("USER_ROLE_GRANTED");
}
@Transactional
@@ -60,5 +75,6 @@ public class UserService {
}
auditService.record(new AuditEvent("USER_ROLE_REVOKED", null, null, "SUCCESS", null, null,
"userId=" + userId + ",roleId=" + roleId));
ddsAuthorizationChangeNotifier.changed("USER_ROLE_REVOKED");
}
}