1
0

rename package (+schema etc.) credentials to accounts (#185)

Co-authored-by: Michael Hoennig <michael@hoennig.de>
Reviewed-on: https://dev.hostsharing.net/hostsharing/hs.hsadmin.ng/pulls/185
Reviewed-by: Timotheus Pokorra <timotheus.pokorra@hostsharing.net>
This commit is contained in:
Michael Hoennig
2025-07-10 11:55:53 +02:00
parent 3603ea911e
commit 97017c1b99
40 changed files with 101 additions and 101 deletions

View File

@@ -216,11 +216,11 @@ openapiProcessor {
targetDir(layout.buildDirectory.dir("generated/sources/openapi-javax").get().asFile.path)
}
process("springCredentials") {
process("springAccounts") {
processorName("spring")
processor("io.openapiprocessor:openapi-processor-spring:2022.5")
apiPath(project.file("src/main/resources/api-definition/credentials/api-paths.yaml").path)
prop("mapping", project.file("src/main/resources/api-definition/credentials/api-mappings.yaml").path)
apiPath(project.file("src/main/resources/api-definition/accounts/api-paths.yaml").path)
prop("mapping", project.file("src/main/resources/api-definition/accounts/api-mappings.yaml").path)
prop("showWarnings", true)
prop("openApiNullable", true)
targetDir(layout.buildDirectory.dir("generated/sources/openapi-javax").get().asFile.path)
@@ -245,7 +245,7 @@ val processSpring = tasks.register("processSpring") {
"processSpringHsOffice",
"processSpringHsBooking",
"processSpringHsHosting",
"processSpringCredentials"
"processSpringAccounts"
)
}

View File

@@ -1,9 +1,9 @@
package net.hostsharing.hsadminng.credentials;
package net.hostsharing.hsadminng.hs.accounts;
import jakarta.persistence.EntityManager;
import jakarta.persistence.EntityNotFoundException;
import net.hostsharing.hsadminng.config.MessageTranslator;
import net.hostsharing.hsadminng.credentials.generated.api.v1.model.ContextResource;
import net.hostsharing.hsadminng.accounts.generated.api.v1.model.ContextResource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

View File

@@ -1,4 +1,4 @@
package net.hostsharing.hsadminng.credentials;
package net.hostsharing.hsadminng.hs.accounts;
import jakarta.persistence.Column;
import jakarta.persistence.GeneratedValue;

View File

@@ -1,4 +1,4 @@
package net.hostsharing.hsadminng.credentials;
package net.hostsharing.hsadminng.hs.accounts;
import jakarta.persistence.AttributeOverride;
import jakarta.persistence.AttributeOverrides;
@@ -24,7 +24,7 @@ import static net.hostsharing.hsadminng.rbac.generator.RbacSpec.WITHOUT_IMPLICIT
import static net.hostsharing.hsadminng.rbac.generator.RbacSpec.rbacViewFor;
@Entity
@Table(schema = "hs_credentials", name = "context") // TODO_impl: RBAC rules for _rv do not yet work properly
@Table(schema = "hs_accounts", name = "context") // TODO_impl: RBAC rules for _rv do not yet work properly
@SuperBuilder(toBuilder = true)
@Getter
@Setter
@@ -50,6 +50,6 @@ public class HsCredentialsContextRbacEntity extends HsCredentialsContext {
// TODO_impl: RBAC rules for _rv do not yet work properly (remove the X)
public static void mainX(String[] args) throws IOException {
rbacX().generateWithBaseFileName("9-hs-global/950-credentials/9513-hs-credentials-rbac");
rbacX().generateWithBaseFileName("9-hs-global/950-accounts/9513-hs-credentials-rbac");
}
}

View File

@@ -1,4 +1,4 @@
package net.hostsharing.hsadminng.credentials;
package net.hostsharing.hsadminng.hs.accounts;
import io.micrometer.core.annotation.Timed;
import org.springframework.data.repository.Repository;

View File

@@ -1,4 +1,4 @@
package net.hostsharing.hsadminng.credentials;
package net.hostsharing.hsadminng.hs.accounts;
import jakarta.persistence.AttributeOverride;
import jakarta.persistence.AttributeOverrides;
@@ -11,7 +11,7 @@ import lombok.Setter;
import lombok.experimental.SuperBuilder;
@Entity
@Table(schema = "hs_credentials", name = "context")
@Table(schema = "hs_accounts", name = "context")
@SuperBuilder(toBuilder = true)
@Getter
@Setter

View File

@@ -1,4 +1,4 @@
package net.hostsharing.hsadminng.credentials;
package net.hostsharing.hsadminng.hs.accounts;
import io.micrometer.core.annotation.Timed;
import org.springframework.data.repository.Repository;

View File

@@ -1,12 +1,12 @@
package net.hostsharing.hsadminng.credentials;
package net.hostsharing.hsadminng.hs.accounts;
import java.util.List;
import io.micrometer.core.annotation.Timed;
import net.hostsharing.hsadminng.config.NoSecurityRequirement;
import net.hostsharing.hsadminng.context.Context;
import net.hostsharing.hsadminng.credentials.generated.api.v1.api.ContextsApi;
import net.hostsharing.hsadminng.credentials.generated.api.v1.model.ContextResource;
import net.hostsharing.hsadminng.accounts.generated.api.v1.api.ContextsApi;
import net.hostsharing.hsadminng.accounts.generated.api.v1.model.ContextResource;
import net.hostsharing.hsadminng.mapper.StrictMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;

View File

@@ -1,4 +1,4 @@
package net.hostsharing.hsadminng.credentials;
package net.hostsharing.hsadminng.hs.accounts;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
@@ -10,11 +10,11 @@ import io.micrometer.core.annotation.Timed;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import net.hostsharing.hsadminng.config.MessageTranslator;
import net.hostsharing.hsadminng.context.Context;
import net.hostsharing.hsadminng.credentials.generated.api.v1.api.CredentialsApi;
import net.hostsharing.hsadminng.credentials.generated.api.v1.model.CredentialsInsertResource;
import net.hostsharing.hsadminng.credentials.generated.api.v1.model.CredentialsPatchResource;
import net.hostsharing.hsadminng.credentials.generated.api.v1.model.CredentialsResource;
import net.hostsharing.hsadminng.credentials.generated.api.v1.model.HsOfficePersonResource;
import net.hostsharing.hsadminng.accounts.generated.api.v1.api.CredentialsApi;
import net.hostsharing.hsadminng.accounts.generated.api.v1.model.CredentialsInsertResource;
import net.hostsharing.hsadminng.accounts.generated.api.v1.model.CredentialsPatchResource;
import net.hostsharing.hsadminng.accounts.generated.api.v1.model.CredentialsResource;
import net.hostsharing.hsadminng.accounts.generated.api.v1.model.HsOfficePersonResource;
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRbacRepository;
import net.hostsharing.hsadminng.mapper.StrictMapper;
import net.hostsharing.hsadminng.persistence.EntityManagerWrapper;
@@ -118,7 +118,7 @@ public class HsCredentialsController implements CredentialsApi {
// return the new credentials as a resource
final var uri =
MvcUriComponentsBuilder.fromController(getClass())
.path("/api/hs/credentials/credentials/{id}")
.path("/api/hs/accounts/credentials/{id}")
.buildAndExpand(newCredentialsEntity.getUuid())
.toUri();
final var newCredentialsResource = mapper.map(

View File

@@ -1,4 +1,4 @@
package net.hostsharing.hsadminng.credentials;
package net.hostsharing.hsadminng.hs.accounts;
import jakarta.persistence.*;
import lombok.*;
@@ -19,7 +19,7 @@ import static jakarta.persistence.CascadeType.REFRESH;
import static net.hostsharing.hsadminng.repr.Stringify.stringify;
@Entity
@Table(schema = "hs_credentials", name = "credentials")
@Table(schema = "hs_accounts", name = "credentials")
@Getter
@Setter
@Builder
@@ -79,7 +79,7 @@ public class HsCredentialsEntity implements BaseEntity<HsCredentialsEntity>, Str
@OneToMany(fetch = FetchType.LAZY, cascade = { MERGE, REFRESH }, orphanRemoval = true)
@JoinTable(
name = "context_mapping", schema = "hs_credentials",
name = "context_mapping", schema = "hs_accounts",
joinColumns = @JoinColumn(name = "credentials_uuid", referencedColumnName = "uuid"),
inverseJoinColumns = @JoinColumn(name = "context_uuid", referencedColumnName = "uuid")
)

View File

@@ -1,6 +1,6 @@
package net.hostsharing.hsadminng.credentials;
package net.hostsharing.hsadminng.hs.accounts;
import net.hostsharing.hsadminng.credentials.generated.api.v1.model.CredentialsPatchResource;
import net.hostsharing.hsadminng.accounts.generated.api.v1.model.CredentialsPatchResource;
import net.hostsharing.hsadminng.mapper.EntityPatcher;
import net.hostsharing.hsadminng.mapper.OptionalFromJson;

View File

@@ -1,4 +1,4 @@
package net.hostsharing.hsadminng.credentials;
package net.hostsharing.hsadminng.hs.accounts;
import io.micrometer.core.annotation.Timed;
import net.hostsharing.hsadminng.hs.office.person.HsOfficePerson;

View File

@@ -1,7 +1,7 @@
openapi-processor-mapping: v2
options:
package-name: net.hostsharing.hsadminng.credentials.generated.api.v1
package-name: net.hostsharing.hsadminng.accounts.generated.api.v1
model-name-suffix: Resource
bean-validation: true
@@ -13,5 +13,5 @@ map:
- type: string:uuid => java.util.UUID
paths:
/api/hs/credentials/credentials/{credentialsUuid}:
/api/hs/accounts/credentials/{credentialsUuid}:
null: org.openapitools.jackson.nullable.JsonNullable

View File

@@ -10,18 +10,18 @@ paths:
# Contexts
/api/hs/credentials/contexts:
/api/hs/accounts/contexts:
$ref: "contexts.yaml"
# Credentials
/api/hs/credentials/credentials/{credentialsUuid}/used:
/api/hs/accounts/credentials/{credentialsUuid}/used:
$ref: "credentials-with-uuid-used.yaml"
/api/hs/credentials/credentials/{credentialsUuid}:
/api/hs/accounts/credentials/{credentialsUuid}:
$ref: "credentials-with-uuid.yaml"
/api/hs/credentials/credentials:
/api/hs/accounts/credentials:
$ref: "credentials.yaml"

View File

@@ -1,6 +1,6 @@
get:
summary: Returns a list of all credentials.
description: Returns the list of all credentials which are visible to the current subject or any of it's assumed roles.
description: Returns the list of all credentials which are visible to the current subject or any of it's assumed roles.
tags:
- credentials
operationId: getListOfCredentialsByPersonUuid

View File

@@ -4,5 +4,5 @@
-- ============================================================================
--changeset michael.hoennig:hs-credentials-SCHEMA endDelimiter:--//
-- ----------------------------------------------------------------------------
CREATE SCHEMA hs_credentials;
CREATE SCHEMA hs_accounts;
--//

View File

@@ -5,7 +5,7 @@
--changeset michael.hoennig:hs-credentials-CREDENTIALS-TABLE endDelimiter:--//
-- ----------------------------------------------------------------------------
create table hs_credentials.credentials
create table hs_accounts.credentials
(
uuid uuid PRIMARY KEY references rbac.subject (uuid) initially deferred,
version int not null default 0,
@@ -30,7 +30,7 @@ create table hs_credentials.credentials
--changeset michael.hoennig:hs-credentials-context-CONTEXT-TABLE endDelimiter:--//
-- ----------------------------------------------------------------------------
create table hs_credentials.context
create table hs_accounts.context
(
uuid uuid PRIMARY KEY,
version int not null default 0,
@@ -46,47 +46,47 @@ create table hs_credentials.context
-- ============================================================================
--changeset michael.hoennig:hs-credentials-CONTEXT-IMMUTABLE-TRIGGER endDelimiter:--//
-- ----------------------------------------------------------------------------
CREATE OR REPLACE FUNCTION hs_credentials.prevent_context_update()
CREATE OR REPLACE FUNCTION hs_accounts.prevent_context_update()
RETURNS TRIGGER AS $$
BEGIN
RAISE EXCEPTION 'Updates to hs_credentials.context are not allowed.';
RAISE EXCEPTION 'Updates to hs_accounts.context are not allowed.';
END;
$$ LANGUAGE plpgsql;
-- Trigger to enforce immutability
CREATE TRIGGER context_immutable_trigger
BEFORE UPDATE ON hs_credentials.context
FOR EACH ROW EXECUTE FUNCTION hs_credentials.prevent_context_update();
BEFORE UPDATE ON hs_accounts.context
FOR EACH ROW EXECUTE FUNCTION hs_accounts.prevent_context_update();
--//
-- ============================================================================
--changeset michael.hoennig:hs_credentials-CONTEXT-MAPPING endDelimiter:--//
--changeset michael.hoennig:hs_accounts-CONTEXT-MAPPING endDelimiter:--//
-- ----------------------------------------------------------------------------
create table hs_credentials.context_mapping
create table hs_accounts.context_mapping
(
uuid uuid PRIMARY KEY DEFAULT uuid_generate_v4(),
credentials_uuid uuid references hs_credentials.credentials(uuid) ON DELETE CASCADE,
context_uuid uuid references hs_credentials.context(uuid) ON DELETE RESTRICT
credentials_uuid uuid references hs_accounts.credentials(uuid) ON DELETE CASCADE,
context_uuid uuid references hs_accounts.context(uuid) ON DELETE RESTRICT
);
--//
-- ============================================================================
--changeset michael.hoennig:hs-hs_credentials-JOURNALS endDelimiter:--//
--changeset michael.hoennig:hs-hs_accounts-JOURNALS endDelimiter:--//
-- ----------------------------------------------------------------------------
call base.create_journal('hs_credentials.context_mapping');
call base.create_journal('hs_credentials.context');
call base.create_journal('hs_credentials.credentials');
call base.create_journal('hs_accounts.context_mapping');
call base.create_journal('hs_accounts.context');
call base.create_journal('hs_accounts.credentials');
--//
-- ============================================================================
--changeset michael.hoennig:hs_credentials-HISTORICIZATION endDelimiter:--//
--changeset michael.hoennig:hs_accounts-HISTORICIZATION endDelimiter:--//
-- ----------------------------------------------------------------------------
call base.tx_create_historicization('hs_credentials.context_mapping');
call base.tx_create_historicization('hs_credentials.context');
call base.tx_create_historicization('hs_credentials.credentials');
call base.tx_create_historicization('hs_accounts.context_mapping');
call base.tx_create_historicization('hs_accounts.context');
call base.tx_create_historicization('hs_accounts.credentials');
--//

View File

@@ -2,7 +2,7 @@
-- ============================================================================
--changeset michael.hoennig:hs_credentials-credentials-TEST-DATA context:!without-test-data endDelimiter:--//
--changeset michael.hoennig:hs_accounts-credentials-TEST-DATA context:!without-test-data endDelimiter:--//
-- ----------------------------------------------------------------------------
do language plpgsql $$
@@ -13,9 +13,9 @@ declare
superuserFranSubjectUuid uuid;
personFranUuid uuid;
context_HSADMIN_prod hs_credentials.context;
context_SSH_internal hs_credentials.context;
context_MATRIX_internal hs_credentials.context;
context_HSADMIN_prod hs_accounts.context;
context_SSH_internal hs_accounts.context;
context_MATRIX_internal hs_accounts.context;
begin
call base.defineContext('creating booking-project test-data', null, 'superuser-alex@hostsharing.net', 'rbac.global#global:ADMIN');
@@ -26,13 +26,13 @@ begin
personFranUuid = (SELECT uuid FROM hs_office.person WHERE givenName='Fran');
-- Add test contexts
INSERT INTO hs_credentials.context (uuid, type, qualifier) VALUES
INSERT INTO hs_accounts.context (uuid, type, qualifier) VALUES
('11111111-1111-1111-1111-111111111111', 'HSADMIN', 'prod')
RETURNING * INTO context_HSADMIN_prod;
INSERT INTO hs_credentials.context (uuid, type, qualifier) VALUES
INSERT INTO hs_accounts.context (uuid, type, qualifier) VALUES
('22222222-2222-2222-2222-222222222222', 'SSH', 'internal')
RETURNING * INTO context_SSH_internal;
INSERT INTO hs_credentials.context (uuid, type, qualifier) VALUES
INSERT INTO hs_accounts.context (uuid, type, qualifier) VALUES
('33333333-3333-3333-3333-333333333333', 'MATRIX', 'internal')
RETURNING * INTO context_MATRIX_internal;
@@ -47,16 +47,16 @@ begin
-- call rbac.grantPermissionToRole(
-- rbac.createPermission(context_MATRIX_internal.uuid, 'SELECT'),
-- rbac.global_ADMIN());
-- call rbac.grantRoleToRole(hs_credentials.context_REFERRER(context_SSH_internal), rbac.global_ADMIN());
-- call rbac.grantRoleToRole(hs_credentials.context_REFERRER(context_MATRIX_internal), rbac.global_ADMIN());
-- call rbac.grantRoleToRole(hs_accounts.context_REFERRER(context_SSH_internal), rbac.global_ADMIN());
-- call rbac.grantRoleToRole(hs_accounts.context_REFERRER(context_MATRIX_internal), rbac.global_ADMIN());
-- Add test credentials (linking to assumed rbac.subject UUIDs)
INSERT INTO hs_credentials.credentials (uuid, version, person_uuid, active, global_uid, global_gid, onboarding_token, totp_secret, phone_password, email_address, sms_number) VALUES
INSERT INTO hs_accounts.credentials (uuid, version, person_uuid, active, global_uid, global_gid, onboarding_token, totp_secret, phone_password, email_address, sms_number) VALUES
( superuserAlexSubjectUuid, 0, personAlexUuid, true, 1001, 1001, 'token-abc', 'otp-secret-1', 'phone-pw-1', 'alex@example.com', '111-222-3333'),
( superuserFranSubjectUuid, 0, personFranUuid, true, 1002, 1002, 'token-def', 'otp-secret-2', 'phone-pw-2', 'fran@example.com', '444-555-6666');
-- Map credentials to contexts
INSERT INTO hs_credentials.context_mapping (credentials_uuid, context_uuid) VALUES
INSERT INTO hs_accounts.context_mapping (credentials_uuid, context_uuid) VALUES
(superuserAlexSubjectUuid, '11111111-1111-1111-1111-111111111111'), -- HSADMIN context
(superuserFranSubjectUuid, '11111111-1111-1111-1111-111111111111'), -- HSADMIN context
(superuserAlexSubjectUuid, '22222222-2222-2222-2222-222222222222'), -- SSH context

View File

@@ -103,7 +103,7 @@ databaseChangeLog:
file: db/changelog/5-hs-office/502-person/5028-hs-office-person-test-data.sql
context: "!without-test-data"
- include:
file: db/changelog/5-hs-office/502-person/5028-hs-office-person-test-data-for-credentials.sql
file: db/changelog/5-hs-office/502-person/5028-hs-office-person-test-data-for-accounts.sql
context: "!without-test-data"
- include:
file: db/changelog/5-hs-office/503-relation/5030-hs-office-relation.sql
@@ -218,16 +218,16 @@ databaseChangeLog:
context: "!only-prod-schema"
- include:
file: db/changelog/9-hs-global/950-credentials/9500-hs-credentials-schema.sql
file: db/changelog/9-hs-global/950-accounts/9500-hs-accounts-schema.sql
context: "!only-prod-schema"
- include:
file: db/changelog/9-hs-global/950-credentials/9510-hs-credentials.sql
file: db/changelog/9-hs-global/950-accounts/9510-hs-accounts.sql
context: "!only-prod-schema"
# TODO_impl: RBAC rules for _rv do not yet work properly
# - include:
# file: db/changelog/9-hs-global/950-credentials/9513-hs-credentials-rbac.sql
# file: db/changelog/9-hs-global/950-accounts/9513-hs-accounts-context-rbac.sql
- include:
file: db/changelog/9-hs-global/950-credentials/9519-hs-credentials-test-data.sql
file: db/changelog/9-hs-global/950-accounts/9519-hs-accounts-test-data.sql
context: "!only-prod-schema and !without-test-data"
- include:

View File

@@ -49,8 +49,8 @@ public class ArchitectureTest {
"..test.pac",
"..test.dom",
"..context",
"..credentials",
"..credentials.scenarios",
"..accounts",
"..accounts.scenarios",
"..hash",
"..lambda",
"..journal",
@@ -176,7 +176,7 @@ public class ArchitectureTest {
"..hs.office.(*)..",
"..hs.booking.(*)..",
"..hs.hosting.(*)..",
"..credentials..",
"..hs.accounts..",
"..hs.scenarios",
"..hs.migration",
"..rbacgrant" // TODO.test: just because of RbacGrantsDiagramServiceIntegrationTest

View File

@@ -1,4 +1,4 @@
package net.hostsharing.hsadminng.credentials;
package net.hostsharing.hsadminng.hs.accounts;
import org.junit.jupiter.api.Test;

View File

@@ -1,4 +1,4 @@
package net.hostsharing.hsadminng.credentials;
package net.hostsharing.hsadminng.hs.accounts;
import net.hostsharing.hsadminng.context.Context;
import net.hostsharing.hsadminng.rbac.context.ContextBasedTest;
@@ -162,6 +162,6 @@ class HsCredentialsContextRbacRepositoryIntegrationTest extends ContextBasedTest
assertThat(exception)
.isInstanceOf(PersistenceException.class)
.hasCauseInstanceOf(PSQLException.class)
.hasMessageContaining("ERROR: Updates to hs_credentials.context are not allowed.");
.hasMessageContaining("ERROR: Updates to hs_accounts.context are not allowed.");
}
}

View File

@@ -1,4 +1,4 @@
package net.hostsharing.hsadminng.credentials;
package net.hostsharing.hsadminng.hs.accounts;
import org.junit.jupiter.api.Test;

View File

@@ -1,4 +1,4 @@
package net.hostsharing.hsadminng.credentials;
package net.hostsharing.hsadminng.hs.accounts;
import net.hostsharing.hsadminng.context.Context;
import net.hostsharing.hsadminng.rbac.context.ContextBasedTest;
@@ -44,7 +44,7 @@ class HsCredentialsContextRealRepositoryIntegrationTest extends ContextBasedTest
@Test
public void historizationIsAvailable() {
// given
final String nativeQuerySql = "select * from hs_credentials.context_hv";
final String nativeQuerySql = "select * from hs_accounts.context_hv";
// when
historicalContext(Timestamp.from(ZonedDateTime.now().minusDays(1).toInstant()));
@@ -52,7 +52,7 @@ class HsCredentialsContextRealRepositoryIntegrationTest extends ContextBasedTest
final var rowsBefore = query.getResultList();
// then
assertThat(rowsBefore).as("hs_credentials.context_hv only contain no rows for a timestamp before test data creation").hasSize(0);
assertThat(rowsBefore).as("hs_accounts.context_hv only contain no rows for a timestamp before test data creation").hasSize(0);
// and when
historicalContext(Timestamp.from(ZonedDateTime.now().toInstant()));
@@ -60,7 +60,7 @@ class HsCredentialsContextRealRepositoryIntegrationTest extends ContextBasedTest
final var rowsAfter = query.getResultList();
// then
assertThat(rowsAfter).as("hs_credentials.context_hv should now contain the test-data rows for the current timestamp").hasSize(3);
assertThat(rowsAfter).as("hs_accounts.context_hv should now contain the test-data rows for the current timestamp").hasSize(3);
}
@Test
@@ -172,6 +172,6 @@ class HsCredentialsContextRealRepositoryIntegrationTest extends ContextBasedTest
assertThat(exception)
.isInstanceOf(PersistenceException.class)
.hasCauseInstanceOf(PSQLException.class)
.hasMessageContaining("ERROR: Updates to hs_credentials.context are not allowed.");
.hasMessageContaining("ERROR: Updates to hs_accounts.context are not allowed.");
}
}

View File

@@ -1,4 +1,4 @@
package net.hostsharing.hsadminng.credentials;
package net.hostsharing.hsadminng.hs.accounts;
import static net.hostsharing.hsadminng.test.JsonMatcher.lenientlyEquals;
import static org.mockito.ArgumentMatchers.any;
@@ -97,7 +97,7 @@ class HsCredentialsContextsControllerRestTest {
// when
mockMvc.perform(MockMvcRequestBuilders
.get("/api/hs/credentials/contexts")
.get("/api/hs/accounts/contexts")
.header("Authorization", "Bearer superuser-alex@hostsharing.net")
.accept(MediaType.APPLICATION_JSON))
.andDo(print())

View File

@@ -1,4 +1,4 @@
package net.hostsharing.hsadminng.credentials;
package net.hostsharing.hsadminng.hs.accounts;
import net.hostsharing.hsadminng.config.DisableSecurityConfig;
import net.hostsharing.hsadminng.config.JsonObjectMapperConfiguration;
@@ -97,7 +97,7 @@ class HsCredentialsControllerRestTest {
// when
mockMvc.perform(MockMvcRequestBuilders
.post("/api/hs/credentials/credentials/%{credentialsUuid}/used"
.post("/api/hs/accounts/credentials/%{credentialsUuid}/used"
.replace("%{credentialsUuid}", givenCredentialsUuid.toString()))
.header("Authorization", "Bearer superuser-alex@hostsharing.net")
.accept(MediaType.APPLICATION_JSON))

View File

@@ -1,8 +1,8 @@
package net.hostsharing.hsadminng.credentials;
package net.hostsharing.hsadminng.hs.accounts;
import net.hostsharing.hsadminng.config.MessageTranslator;
import net.hostsharing.hsadminng.credentials.generated.api.v1.model.ContextResource;
import net.hostsharing.hsadminng.credentials.generated.api.v1.model.CredentialsPatchResource;
import net.hostsharing.hsadminng.accounts.generated.api.v1.model.ContextResource;
import net.hostsharing.hsadminng.accounts.generated.api.v1.model.CredentialsPatchResource;
import net.hostsharing.hsadminng.rbac.test.PatchUnitTestBase;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.TestInstance;

View File

@@ -1,4 +1,4 @@
package net.hostsharing.hsadminng.credentials;
package net.hostsharing.hsadminng.hs.accounts;
import net.hostsharing.hsadminng.context.Context;
import net.hostsharing.hsadminng.hs.office.person.HsOfficePersonRbacEntity;
@@ -66,7 +66,7 @@ class HsCredentialsRepositoryIntegrationTest extends ContextBasedTest {
@Test
public void historizationIsAvailable() {
// given
final String nativeQuerySql = "select * from hs_credentials.credentials_hv";
final String nativeQuerySql = "select * from hs_accounts.credentials_hv";
// when
historicalContext(Timestamp.from(ZonedDateTime.now().minusDays(1).toInstant()));
@@ -74,7 +74,7 @@ class HsCredentialsRepositoryIntegrationTest extends ContextBasedTest {
final var rowsBefore = query.getResultList();
// then
assertThat(rowsBefore).as("hs_credentials.credentials_hv only contain no rows for a timestamp before test data creation").hasSize(0);
assertThat(rowsBefore).as("hs_accounts.credentials_hv only contain no rows for a timestamp before test data creation").hasSize(0);
// and when
historicalContext(Timestamp.from(ZonedDateTime.now().toInstant()));
@@ -82,7 +82,7 @@ class HsCredentialsRepositoryIntegrationTest extends ContextBasedTest {
final var rowsAfter = query.getResultList();
// then
assertThat(rowsAfter).as("hs_credentials.credentials_hv should now contain the test-data rows for the current timestamp").hasSize(2);
assertThat(rowsAfter).as("hs_accounts.credentials_hv should now contain the test-data rows for the current timestamp").hasSize(2);
}
@Test

View File

@@ -1,4 +1,4 @@
package net.hostsharing.hsadminng.credentials.scenarios;
package net.hostsharing.hsadminng.hs.accounts.scenarios;
import io.restassured.http.ContentType;
import net.hostsharing.hsadminng.hs.scenarios.ScenarioTest;
@@ -28,11 +28,11 @@ public class CreateCredentials extends UseCase<CreateCredentials> {
obtain("CredentialsContexts", () ->
httpGet("/api/hs/credentials/contexts").expecting(OK).expecting(JSON)
httpGet("/api/hs/accounts/contexts").expecting(OK).expecting(JSON)
);
return obtain("newCredentials", () ->
httpPost("/api/hs/credentials/credentials", usingJsonBody("""
httpPost("/api/hs/accounts/credentials", usingJsonBody("""
{
"person.uuid": ${Person: %{personGivenName} %{personFamilyName}},
"nickname": ${nickname},
@@ -53,7 +53,7 @@ public class CreateCredentials extends UseCase<CreateCredentials> {
protected void verify(final UseCase<CreateCredentials>.HttpResponse response) {
verify(
"Verify the New Credentials",
() -> httpGet("/api/hs/credentials/credentials/%{newCredentials}")
() -> httpGet("/api/hs/accounts/credentials/%{newCredentials}")
.expecting(OK).expecting(JSON),
path("uuid").contains("%{newCredentials}"),
path("nickname").contains("%{nickname}"),

View File

@@ -1,4 +1,4 @@
package net.hostsharing.hsadminng.credentials.scenarios;
package net.hostsharing.hsadminng.hs.accounts.scenarios;
import lombok.SneakyThrows;
import net.hostsharing.hsadminng.HsadminNgApplication;

View File

@@ -12750,7 +12750,7 @@ INSERT INTO public.databasechangelog (id, author, filename, dateexecuted, ordere
INSERT INTO public.databasechangelog (id, author, filename, dateexecuted, orderexecuted, exectype, md5sum, description, comments, tag, liquibase, contexts, labels, deployment_id) VALUES ('rbactest-domain-rbac-update-trigger', 'RolesGrantsAndPermissionsGenerator', 'db/changelog/2-rbactest/203-rbactest-domain/2033-rbactest-domain-rbac.sql', '2025-06-06 10:23:06.53273', 309, 'RERAN', '9:4d2cdd1bc08df6985622d0c5953bf4ba', 'sql', '', NULL, '4.29.2', '!without-test-data', NULL, '9198184942');
INSERT INTO public.databasechangelog (id, author, filename, dateexecuted, orderexecuted, exectype, md5sum, description, comments, tag, liquibase, contexts, labels, deployment_id) VALUES ('hs-office-contact-rbac-insert-trigger', 'RolesGrantsAndPermissionsGenerator', 'db/changelog/5-hs-office/501-contact/5013-hs-office-contact-rbac.sql', '2025-06-06 10:23:06.581665', 310, 'RERAN', '9:b29cf6087a2225d235637a187b5946c2', 'sql', '', NULL, '4.29.2', NULL, NULL, '9198184942');
INSERT INTO public.databasechangelog (id, author, filename, dateexecuted, orderexecuted, exectype, md5sum, description, comments, tag, liquibase, contexts, labels, deployment_id) VALUES ('hs-office-person-rbac-insert-trigger', 'RolesGrantsAndPermissionsGenerator', 'db/changelog/5-hs-office/502-person/5023-hs-office-person-rbac.sql', '2025-06-06 10:23:06.611557', 311, 'RERAN', '9:9adfbff372bce3de87410eb7582869f2', 'sql', '', NULL, '4.29.2', NULL, NULL, '9198184942');
INSERT INTO public.databasechangelog (id, author, filename, dateexecuted, orderexecuted, exectype, md5sum, description, comments, tag, liquibase, contexts, labels, deployment_id) VALUES ('hs-office-person-TEST-DATA-GENERATION-FOR-CREDENTIALS', 'michael.hoennig', 'db/changelog/5-hs-office/502-person/5028-hs-office-person-test-data-for-credentials.sql', '2025-06-06 10:23:06.727793', 312, 'EXECUTED', '9:cf05c4705d539d4ea7b0199921f8cc78', 'sql', '', NULL, '4.29.2', '!without-test-data AND !without-test-data', NULL, '9198184942');
INSERT INTO public.databasechangelog (id, author, filename, dateexecuted, orderexecuted, exectype, md5sum, description, comments, tag, liquibase, contexts, labels, deployment_id) VALUES ('hs-office-person-TEST-DATA-GENERATION-FOR-CREDENTIALS', 'michael.hoennig', 'db/changelog/5-hs-office/502-person/5028-hs-office-person-test-data-for-accounts.sql', '2025-06-06 10:23:06.727793', 312, 'EXECUTED', '9:cf05c4705d539d4ea7b0199921f8cc78', 'sql', '', NULL, '4.29.2', '!without-test-data AND !without-test-data', NULL, '9198184942');
INSERT INTO public.databasechangelog (id, author, filename, dateexecuted, orderexecuted, exectype, md5sum, description, comments, tag, liquibase, contexts, labels, deployment_id) VALUES ('hs-office-relation-debitor-anchor-CONSTRAINT-BY-TRIGGER', 'marc.sandlus', 'db/changelog/5-hs-office/503-relation/5030-hs-office-relation.sql', '2025-06-06 10:23:06.759158', 313, 'EXECUTED', '9:0623a018f7494b53f87b01d88bc3fa41', 'sql', '', NULL, '4.29.2', NULL, NULL, '9198184942');
INSERT INTO public.databasechangelog (id, author, filename, dateexecuted, orderexecuted, exectype, md5sum, description, comments, tag, liquibase, contexts, labels, deployment_id) VALUES ('hs-office-relation-rbac-insert-trigger', 'RolesGrantsAndPermissionsGenerator', 'db/changelog/5-hs-office/503-relation/5033-hs-office-relation-rbac.sql', '2025-06-06 10:23:06.7945', 314, 'RERAN', '9:6fc1a046dcd803edfb0ce77cd127b576', 'sql', '', NULL, '4.29.2', NULL, NULL, '9198184942');
INSERT INTO public.databasechangelog (id, author, filename, dateexecuted, orderexecuted, exectype, md5sum, description, comments, tag, liquibase, contexts, labels, deployment_id) VALUES ('hs-office-relation-rbac-update-trigger', 'RolesGrantsAndPermissionsGenerator', 'db/changelog/5-hs-office/503-relation/5033-hs-office-relation-rbac.sql', '2025-06-06 10:23:06.835025', 315, 'RERAN', '9:6737dfa739a4b9036f3e9e8224019276', 'sql', '', NULL, '4.29.2', NULL, NULL, '9198184942');