commit 73672682cd5cce06a6e4132748132b77f3a3f50f
parent 16150704f6060671446bde886d467c1121fab048
Author: MS <ms@taler.net>
Date: Tue, 19 Jan 2021 12:07:33 +0100
Allowing same connection name for different users.
Diffstat:
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/integration-tests/tests.py b/integration-tests/tests.py
@@ -405,6 +405,28 @@ def test_double_connection_name():
[406] # expecting "406 Not acceptable"
)
+ # Checking that _another_ user can pick the same connection name.
+ assertResponse(
+ post(
+ f"{PERSONA.nexus.base_url}/users",
+ auth=auth.HTTPBasicAuth("admin", "x"),
+ json=dict(username="second-user", password="second-password"),
+ )
+ )
+
+ assertResponse(
+ post(
+ f"{PERSONA.nexus.base_url}/bank-connections",
+ json=dict(
+ name=PERSONA.nexus.bank_connection, # same name from the previous creation.
+ source="new",
+ type="ebics",
+ data=PERSONA.ebics.get_as_dict(with_url=True),
+ ),
+ auth=auth.HTTPBasicAuth("second-user", "second-password")
+ ),
+ )
+
def test_ingestion_camt53_non_singleton():
with open("camt53-gls-style-1.xml") as f:
camt = f.read()
diff --git a/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt b/nexus/src/main/kotlin/tech/libeufin/nexus/DB.kt
@@ -302,14 +302,13 @@ class NexusUserEntity(id: EntityID<String>) : Entity<String>(id) {
}
object NexusBankConnectionsTable : IdTable<String>() {
- override val id = NexusBankConnectionsTable.text("id").entityId().uniqueIndex()
+ override val id = NexusBankConnectionsTable.text("id").entityId()
val type = text("type")
val owner = reference("user", NexusUsersTable)
}
class NexusBankConnectionEntity(id: EntityID<String>) : Entity<String>(id) {
companion object : EntityClass<String, NexusBankConnectionEntity>(NexusBankConnectionsTable)
-
var type by NexusBankConnectionsTable.type
var owner by NexusUserEntity referencedOn NexusBankConnectionsTable.owner
}