diff --git a/ledgers-bank-account-access-management/ledgers-bank-account-access-repository/src/main/java/de/adorsys/ledgers/baam/db/domain/AccessScope.java b/ledgers-bank-account-access-management/ledgers-bank-account-access-repository/src/main/java/de/adorsys/ledgers/baam/db/domain/AccessScope.java index 08a6f28ba..ca929a86a 100644 --- a/ledgers-bank-account-access-management/ledgers-bank-account-access-repository/src/main/java/de/adorsys/ledgers/baam/db/domain/AccessScope.java +++ b/ledgers-bank-account-access-management/ledgers-bank-account-access-repository/src/main/java/de/adorsys/ledgers/baam/db/domain/AccessScope.java @@ -11,4 +11,5 @@ public enum AccessScope { WRITE, EXECUTE, DELETE; + } diff --git a/ledgers-bank-account-access-management/ledgers-bank-account-access-repository/src/main/java/de/adorsys/ledgers/baam/db/domain/AgentAccess.java b/ledgers-bank-account-access-management/ledgers-bank-account-access-repository/src/main/java/de/adorsys/ledgers/baam/db/domain/AgentAccess.java new file mode 100644 index 000000000..40db25d8e --- /dev/null +++ b/ledgers-bank-account-access-management/ledgers-bank-account-access-repository/src/main/java/de/adorsys/ledgers/baam/db/domain/AgentAccess.java @@ -0,0 +1,13 @@ +package de.adorsys.ledgers.baam.db.domain; + +import jakarta.persistence.Entity; +import jakarta.persistence.Table; + +@Entity +@Table(name = "agent_access") +public class AgentAccess extends BankAccountAccess { + + public AgentAccess() { + super(); + } +} diff --git a/ledgers-bank-account-access-management/ledgers-bank-account-access-repository/src/main/java/de/adorsys/ledgers/baam/db/repository/AgentAccessRepository.java b/ledgers-bank-account-access-management/ledgers-bank-account-access-repository/src/main/java/de/adorsys/ledgers/baam/db/repository/AgentAccessRepository.java new file mode 100644 index 000000000..4983ca562 --- /dev/null +++ b/ledgers-bank-account-access-management/ledgers-bank-account-access-repository/src/main/java/de/adorsys/ledgers/baam/db/repository/AgentAccessRepository.java @@ -0,0 +1,11 @@ +package de.adorsys.ledgers.baam.db.repository; + +import de.adorsys.ledgers.baam.db.domain.AgentAccess; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.stereotype.Repository; + +@Repository +public interface AgentAccessRepository extends JpaRepository { + +} + diff --git a/ledgers-bank-account-access-management/ledgers-bank-account-access-repository/src/test/java/de/adorsys/ledgers/baam/db/repository/AgentAccessRepositoryIT.java b/ledgers-bank-account-access-management/ledgers-bank-account-access-repository/src/test/java/de/adorsys/ledgers/baam/db/repository/AgentAccessRepositoryIT.java new file mode 100644 index 000000000..416ca6e34 --- /dev/null +++ b/ledgers-bank-account-access-management/ledgers-bank-account-access-repository/src/test/java/de/adorsys/ledgers/baam/db/repository/AgentAccessRepositoryIT.java @@ -0,0 +1,51 @@ +package de.adorsys.ledgers.baam.db.repository; + +import com.github.springtestdbunit.DbUnitTestExecutionListener; +import de.adorsys.ledgers.baam.db.domain.*; +import de.adorsys.ledgers.baam.db.test.BaamRepositoryApplication; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.TestExecutionListeners; +import org.springframework.test.context.junit.jupiter.SpringExtension; +import org.springframework.test.context.support.DependencyInjectionTestExecutionListener; +import org.springframework.test.context.transaction.TransactionalTestExecutionListener; + +import static org.junit.jupiter.api.Assertions.assertNotNull; + +@SpringBootTest(classes = BaamRepositoryApplication.class) +@ExtendWith(SpringExtension.class) +@TestExecutionListeners({DependencyInjectionTestExecutionListener.class, + TransactionalTestExecutionListener.class, + DbUnitTestExecutionListener.class}) + +public class AgentAccessRepositoryIT { + + @Autowired + private AgentAccessRepository agentAccessRepository; + + @Test + void test_create_ok() { + // Given + agentAccessRepository.deleteAll(); // Clean up any existing records + AgentAccess agentAccess = new AgentAccess(); + agentAccess.setId("1"); + agentAccess.setAccountId("1L"); + agentAccess.setEntityId("2L"); + agentAccess.setScope(AccessScope.EXECUTE); // Example action scope + agentAccess.setWeight(0.5); // Partial authority + agentAccess.setConditions(AccessCondition.AMOUNT_RESTRICTED); // Example condition + agentAccess.setStatus(AccessStatus.ACTIVE); // Agent is active + agentAccess.setPolicies("Payment-Only Policy"); // Example policy + + // When + AgentAccess savedAccess = agentAccessRepository.save(agentAccess); + + // Retrieve the saved object + AgentAccess result = agentAccessRepository.findById(savedAccess.getId()).orElse(null); + + // Then + assertNotNull(result); + } +} diff --git a/ledgers-user-management/ledgers-user-management-service-api/src/main/java/de/adorsys/ledgers/um/api/service/UserService.java b/ledgers-user-management/ledgers-user-management-service-api/src/main/java/de/adorsys/ledgers/um/api/service/UserService.java index 923810cf8..5a084ba3f 100644 --- a/ledgers-user-management/ledgers-user-management-service-api/src/main/java/de/adorsys/ledgers/um/api/service/UserService.java +++ b/ledgers-user-management/ledgers-user-management-service-api/src/main/java/de/adorsys/ledgers/um/api/service/UserService.java @@ -7,11 +7,18 @@ //NOPMD -import de.adorsys.ledgers.um.api.domain.*; -import org.springframework.data.domain.*; - -import java.time.*; -import java.util.*; +import de.adorsys.ledgers.um.api.domain.UserBO; +import de.adorsys.ledgers.um.api.domain.ScaUserDataBO; +import de.adorsys.ledgers.um.api.domain.AccountAccessBO; +import de.adorsys.ledgers.um.api.domain.AisConsentBO; +import de.adorsys.ledgers.um.api.domain.UserExtendedBO; +import de.adorsys.ledgers.um.api.domain.UserRoleBO; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; + +import java.time.LocalDateTime; +import java.util.List; +import java.util.Map; public interface UserService {