Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:added project access account templates #42

Merged
merged 2 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions ledgers-account-access/ledgers-acount-access-repository/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2018-2023 adorsys GmbH and Co. KG
~ All rights are reserved.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>de.adorsys.ledgers</groupId>
<artifactId>ledgers-account-access</artifactId>
<version>6.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>ledgers-acount-access-repository</artifactId>
<packaging>jar</packaging>

<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<ruleset.basedir>../..</ruleset.basedir>
</properties>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>jakarta.persistence</groupId>
<artifactId>jakarta.persistence-api</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-autoconfigure</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* Copyright (c) 2018-2023 adorsys GmbH and Co. KG
* All rights are reserved.
*/

package de.adorsys.ledgers.aa.db;
//Purpose Package used to document this module. We user this
//to reference the package to be scanned for repositories.

public class AccountAccessBasePackage {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright (c) 2018-2023 adorsys GmbH and Co. KG
* All rights are reserved.
*/

package de.adorsys.ledgers.aa.db;

import org.springframework.context.annotation.*;
import org.springframework.data.jpa.repository.config.*;
@Configuration
@ComponentScan(basePackageClasses = {AccountAccessBasePackage.class})
@EnableJpaRepositories
//@EntityScan(basePackages = "de.adorsys.ledgers.aa.db.domain")

public class AccountAccessRepositoryConfiguration {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright (c) 2018-2023 adorsys GmbH and Co. KG
* All rights are reserved.
*/

package de.adorsys.ledgers.aa.db;
import org.springframework.context.annotation.Import;

import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
@Retention(value = java.lang.annotation.RetentionPolicy.RUNTIME)
@Target(value = {java.lang.annotation.ElementType.TYPE})
@Documented
@Import({
AccountAccessRepositoryConfiguration.class
})
public @interface EnableAccountAccessRepository {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (c) 2018-2023 adorsys GmbH and Co. KG
* All rights are reserved.
*/

package de.adorsys.ledgers.aa.db.domain;
import java.util.UUID;
import jakarta.persistence.Id;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Entity;
import lombok.Data;
@Entity
@Data
public class AccountAccessEntity {
@Id
@GeneratedValue
private UUID id;

private UUID entityId;
private UUID accountId;
private String name;
private UUID template; // Reference to AccountAccessTemplateEntity

// Constructors, getters and setters
public AccountAccessEntity() {
}

public AccountAccessEntity(UUID entityId, UUID accountId, String name, UUID template) {
this.entityId = entityId;
this.accountId = accountId;
this.name = name;
this.template = template;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright (c) 2018-2023 adorsys GmbH and Co. KG
* All rights are reserved.
*/

package de.adorsys.ledgers.aa.db.domain;

import java.util.List;
import java.util.UUID;
import lombok.Data;
import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import jakarta.persistence.ElementCollection;

@Entity
@Data
public class AccountAccessTemplateEntity {

@Id
@GeneratedValue
private UUID id;

private String templateName;
@ElementCollection
private List<String> permissions;
@ElementCollection
private List<String> parameters;

// Constructors, getters and setters
public AccountAccessTemplateEntity() {
}

public AccountAccessTemplateEntity(String templateName, List<String> permissions, List<String> parameters) {
this.templateName = templateName;
this.permissions = permissions;
this.parameters = parameters;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright (c) 2018-2023 adorsys GmbH and Co. KG
* All rights are reserved.
*/

package de.adorsys.ledgers.aa.db.domain;

import java.util.UUID;

import jakarta.persistence.Entity;
import jakarta.persistence.GeneratedValue;
import jakarta.persistence.Id;
import lombok.Data;


@Entity
@Data
public class AgentAccessEntity {

@Id
@GeneratedValue
private UUID id;

private UUID agentId;
private UUID accountAccessId;
private UUID subTemplate; // Reference to AccountAccessTemplateEntity

// Constructors, getters and setters
public AgentAccessEntity() {
}

public AgentAccessEntity(UUID agentId, UUID accountAccessId, UUID subTemplate) {
this.agentId = agentId;
this.accountAccessId = accountAccessId;
this.subTemplate = subTemplate;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* Copyright (c) 2018-2023 adorsys GmbH and Co. KG
* All rights are reserved.
*/

package de.adorsys.ledgers.aa.db.repository;
import org.springframework.data.jpa.repository.JpaRepository;
import de.adorsys.ledgers.aa.db.domain.AccountAccessEntity;
import java.util.UUID;

public interface AccountAccessRepository extends JpaRepository<AccountAccessEntity, UUID> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* Copyright (c) 2018-2023 adorsys GmbH and Co. KG
* All rights are reserved.
*/

package de.adorsys.ledgers.aa.db.repository;
import de.adorsys.ledgers.aa.db.domain.AccountAccessTemplateEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.UUID;

public interface AccountAccessTemplateRepository extends JpaRepository<AccountAccessTemplateEntity, UUID> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright (c) 2018-2023 adorsys GmbH and Co. KG
* All rights are reserved.
*/

package de.adorsys.ledgers.aa.db.repository;
import de.adorsys.ledgers.aa.db.domain.AgentAccessEntity;
import org.springframework.data.jpa.repository.JpaRepository;
import java.util.UUID;
import org.springframework.stereotype.Repository;
@Repository
public interface AgentAccessRepository extends JpaRepository<AgentAccessEntity, UUID> {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/*
* Copyright (c) 2018-2023 adorsys GmbH and Co. KG
* All rights are reserved.
*/

package de.adorsys.ledgers.aa.db.test;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.SpringApplication;
@SpringBootApplication
public class AaRepositoryApplication {
public static void main(String[] args){SpringApplication.run(AaRepositoryApplication.class, args);}

}
46 changes: 46 additions & 0 deletions ledgers-account-access/ledgers-acount-access-rest-api/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2018-2023 adorsys GmbH and Co. KG
~ All rights are reserved.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>de.adorsys.ledgers</groupId>
<artifactId>ledgers-account-access</artifactId>
<version>6.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>ledgers-acount-access-rest-api</artifactId>
<packaging>jar</packaging>

<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<ruleset.basedir>../..</ruleset.basedir>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>de.adorsys.ledgers</groupId>
<artifactId>ledgers-acount-access-repository</artifactId>
<version>6.1-SNAPSHOT</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
</dependency>

</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright (c) 2018-2023 adorsys GmbH and Co. KG
* All rights are reserved.
*/

package de.adorsys.ledgers.aa.rest.api.resource;

import de.adorsys.ledgers.aa.db.domain.*;
import io.swagger.v3.oas.annotations.*;
import io.swagger.v3.oas.annotations.tags.*;
import org.springframework.http.*;
import org.springframework.web.bind.annotation.*;
import java.util.*;
@Tag(name = "Account Access", description = "Provide endpoint for managing account access.")
@RequestMapping(AccountAccessRestAPI.BASE_PATH)
public interface AccountAccessRestAPI {

String BASE_PATH = "/api/accesses";

@Operation(summary = "Create an Account Access", description = "Create a new account access entity")
@PostMapping
ResponseEntity<AccountAccessEntity> createAccess(@RequestBody AccountAccessEntity access);

@Operation(summary = "Get Account Access by ID", description = "Retrieve an account access entity by its unique ID")
@GetMapping("/{id}")
ResponseEntity<AccountAccessEntity> getAccessById(@PathVariable UUID id);

@Operation(summary = "Get All Account Accesses", description = "Retrieve a list of all account access entities")
@GetMapping
ResponseEntity<List<AccountAccessEntity>> getAllAccesses();

@Operation(summary = "Update an Account Access", description = "Update an existing account access entity by its ID")
@PutMapping("/{id}")
ResponseEntity<AccountAccessEntity> updateAccess(@PathVariable UUID id, @RequestBody AccountAccessEntity access);

@Operation(summary = "Delete an Account Access", description = "Delete an account access entity by its unique ID")
@DeleteMapping("/{id}")
ResponseEntity<Void> deleteAccess(@PathVariable UUID id);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright (c) 2018-2023 adorsys GmbH and Co. KG
* All rights are reserved.
*/

package de.adorsys.ledgers.aa.rest.api.resource;

import java.util.List;
import java.util.UUID;

import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import de.adorsys.ledgers.aa.db.domain.AccountAccessTemplateEntity;
import org.springframework.web.bind.annotation.RequestMapping;

@RequestMapping("/api/templates")
public interface AccountAccessTemplateRestAPI {

@PostMapping
ResponseEntity<AccountAccessTemplateEntity> createTemplate(@RequestBody AccountAccessTemplateEntity template);

@GetMapping("/{id}")
ResponseEntity<AccountAccessTemplateEntity> getTemplateById(@PathVariable UUID id);

@GetMapping
ResponseEntity<List<AccountAccessTemplateEntity>> getAllTemplates();

@PutMapping("/{id}")
ResponseEntity<AccountAccessTemplateEntity> updateTemplate(@PathVariable UUID id, @RequestBody AccountAccessTemplateEntity template);

@DeleteMapping("/{id}")
ResponseEntity<Void> deleteTemplate(@PathVariable UUID id);
}
Loading
Loading