From 8437acbcdc28a420efbeb9ea3892a43c64295b59 Mon Sep 17 00:00:00 2001 From: Mark Raynsford Date: Thu, 10 Aug 2023 18:31:22 +0000 Subject: [PATCH] Update dependencies. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Update com.github.ben-manes.caffeine:caffeine 3.1.6 → 3.1.8. Update io.opentelemetry:opentelemetry-sdk-logs 1.27.0 → 1.28.0. Update org.jetbrains.kotlin:kotlin-stdlib 1.9.0-RC → 1.9.0. Update com.squareup.okio:okio-jvm 3.3.0 → 3.5.0. Update com.helger:ph-css 7.0.0 → 7.0.1. Update org.junit.jupiter:junit-jupiter-api 5.10.0-M1 → 5.10.0. Update org.junit.jupiter:junit-jupiter-engine 5.10.0-M1 → 5.10.0. Update net.jqwik:jqwik-api 1.7.3 → 1.7.4. Update net.jqwik:jqwik-engine 1.7.3 → 1.7.4. Update io.opentelemetry:opentelemetry-bom 1.27.0 → 1.28.0. Update com.io7m.quarrel:com.io7m.quarrel.core 1.2.0 → 1.3.0. Update com.io7m.quarrel:com.io7m.quarrel.ext.logback 1.2.0 → 1.3.0. Update com.io7m.quarrel:com.io7m.quarrel.ext.xstructural 1.2.0 → 1.3.0. Update ch.qos.logback:logback-classic 1.4.8 → 1.4.11. Update ch.qos.logback:logback-core 1.4.8 → 1.4.11. Update com.io7m.jqpage:com.io7m.jqpage.core 0.0.2 → 0.0.3. Update com.io7m.trasco:com.io7m.trasco.api 1.0.0 → 1.1.0. Update com.io7m.trasco:com.io7m.trasco.vanilla 1.0.0 → 1.1.0. Update org.jooq:jooq 3.18.5 → 3.18.6. Update org.jooq:jooq-postgres-extensions 3.18.5 → 3.18.6. --- .../internal/IdDatabaseAdminsQueries.java | 34 +++++---- .../internal/IdDatabaseAuditQueries.java | 17 +++-- .../internal/IdDatabaseUsersQueries.java | 34 +++++---- .../database/postgres/internal/database.xml | 75 ++++++++++++------- .../shell/admin/internal/IdAShellCmdHelp.java | 2 + pom.xml | 30 ++++---- 6 files changed, 109 insertions(+), 83 deletions(-) diff --git a/com.io7m.idstore.database.postgres/src/main/java/com/io7m/idstore/database/postgres/internal/IdDatabaseAdminsQueries.java b/com.io7m.idstore.database.postgres/src/main/java/com/io7m/idstore/database/postgres/internal/IdDatabaseAdminsQueries.java index d88cb5b6..cefff71d 100644 --- a/com.io7m.idstore.database.postgres/src/main/java/com/io7m/idstore/database/postgres/internal/IdDatabaseAdminsQueries.java +++ b/com.io7m.idstore.database.postgres/src/main/java/com/io7m/idstore/database/postgres/internal/IdDatabaseAdminsQueries.java @@ -41,6 +41,7 @@ import com.io7m.jqpage.core.JQField; import com.io7m.jqpage.core.JQKeysetRandomAccessPageDefinition; import com.io7m.jqpage.core.JQKeysetRandomAccessPagination; +import com.io7m.jqpage.core.JQKeysetRandomAccessPaginationParameters; import com.io7m.jqpage.core.JQOrder; import org.jooq.Condition; import org.jooq.Result; @@ -714,14 +715,14 @@ public IdDatabaseAdminSearchType adminSearch( final var pages = JQKeysetRandomAccessPagination.createPageDefinitions( context, - ADMINS, - List.of(orderField), - List.of(allConditions), - List.of(), - Integer.toUnsignedLong(parameters.limit()), - statement -> { - querySpan.setAttribute(DB_STATEMENT, statement.toString()); - } + JQKeysetRandomAccessPaginationParameters.forTable(ADMINS) + .addSortField(orderField) + .addWhereCondition(allConditions) + .setPageSize(Integer.toUnsignedLong(parameters.limit())) + .setStatementListener(statement -> { + querySpan.setAttribute(DB_STATEMENT, statement.toString()); + }) + .build() ); return new AdminsSearch(pages); @@ -1180,14 +1181,15 @@ public IdDatabaseAdminSearchByEmailType adminSearchByEmail( final var pages = JQKeysetRandomAccessPagination.createPageDefinitions( context, - baseTable, - List.of(orderField), - List.of(allConditions), - List.of(ADMINS.ID), - Integer.toUnsignedLong(parameters.limit()), - statement -> { - querySpan.setAttribute(DB_STATEMENT, statement.toString()); - } + JQKeysetRandomAccessPaginationParameters.forTable(baseTable) + .addSortField(orderField) + .addWhereCondition(allConditions) + .addGroupByField(ADMINS.ID) + .setPageSize(Integer.toUnsignedLong(parameters.limit())) + .setStatementListener(statement -> { + querySpan.setAttribute(DB_STATEMENT, statement.toString()); + }) + .build() ); return new AdminsByEmailSearch(pages); diff --git a/com.io7m.idstore.database.postgres/src/main/java/com/io7m/idstore/database/postgres/internal/IdDatabaseAuditQueries.java b/com.io7m.idstore.database.postgres/src/main/java/com/io7m/idstore/database/postgres/internal/IdDatabaseAuditQueries.java index 6dd37691..d450b090 100644 --- a/com.io7m.idstore.database.postgres/src/main/java/com/io7m/idstore/database/postgres/internal/IdDatabaseAuditQueries.java +++ b/com.io7m.idstore.database.postgres/src/main/java/com/io7m/idstore/database/postgres/internal/IdDatabaseAuditQueries.java @@ -26,6 +26,7 @@ import com.io7m.jqpage.core.JQField; import com.io7m.jqpage.core.JQKeysetRandomAccessPageDefinition; import com.io7m.jqpage.core.JQKeysetRandomAccessPagination; +import com.io7m.jqpage.core.JQKeysetRandomAccessPaginationParameters; import com.io7m.jqpage.core.JQOrder; import org.jooq.Condition; import org.jooq.Select; @@ -115,14 +116,14 @@ public IdDatabaseAuditEventsSearchType auditEventsSearch( final var pages = JQKeysetRandomAccessPagination.createPageDefinitions( context, - baseTable, - List.of(new JQField(AUDIT.ID, JQOrder.ASCENDING)), - List.of(allConditions), - List.of(), - Integer.toUnsignedLong(parameters.limit()), - statement -> { - querySpan.setAttribute(DB_STATEMENT, statement.toString()); - } + JQKeysetRandomAccessPaginationParameters.forTable(baseTable) + .setPageSize(Integer.toUnsignedLong(parameters.limit())) + .addSortField(new JQField(AUDIT.ID, JQOrder.ASCENDING)) + .addWhereCondition(allConditions) + .setStatementListener(statement -> { + querySpan.setAttribute(DB_STATEMENT, statement.toString()); + }) + .build() ); return new AuditEventsSearch(baseTable, pages); diff --git a/com.io7m.idstore.database.postgres/src/main/java/com/io7m/idstore/database/postgres/internal/IdDatabaseUsersQueries.java b/com.io7m.idstore.database.postgres/src/main/java/com/io7m/idstore/database/postgres/internal/IdDatabaseUsersQueries.java index bf567ca3..baa6c4ef 100644 --- a/com.io7m.idstore.database.postgres/src/main/java/com/io7m/idstore/database/postgres/internal/IdDatabaseUsersQueries.java +++ b/com.io7m.idstore.database.postgres/src/main/java/com/io7m/idstore/database/postgres/internal/IdDatabaseUsersQueries.java @@ -45,6 +45,7 @@ import com.io7m.jqpage.core.JQField; import com.io7m.jqpage.core.JQKeysetRandomAccessPageDefinition; import com.io7m.jqpage.core.JQKeysetRandomAccessPagination; +import com.io7m.jqpage.core.JQKeysetRandomAccessPaginationParameters; import com.io7m.jqpage.core.JQOrder; import org.jooq.Condition; import org.jooq.DSLContext; @@ -1204,14 +1205,14 @@ public IdDatabaseUserSearchType userSearch( final var pages = JQKeysetRandomAccessPagination.createPageDefinitions( context, - USERS, - List.of(orderField), - List.of(allConditions), - List.of(), - Integer.toUnsignedLong(parameters.limit()), - statement -> { - querySpan.setAttribute(DB_STATEMENT, statement.toString()); - } + JQKeysetRandomAccessPaginationParameters.forTable(USERS) + .addSortField(orderField) + .setPageSize(Integer.toUnsignedLong(parameters.limit())) + .addWhereCondition(allConditions) + .setStatementListener(statement -> { + querySpan.setAttribute(DB_STATEMENT, statement.toString()); + }) + .build() ); return new IdDatabaseUsersQueries.UsersSearch(pages); @@ -1279,14 +1280,15 @@ public IdDatabaseUserSearchByEmailType userSearchByEmail( final var pages = JQKeysetRandomAccessPagination.createPageDefinitions( context, - baseTable, - List.of(orderField), - List.of(allConditions), - List.of(USERS.ID), - Integer.toUnsignedLong(parameters.limit()), - statement -> { - querySpan.setAttribute(DB_STATEMENT, statement.toString()); - } + JQKeysetRandomAccessPaginationParameters.forTable(baseTable) + .addSortField(orderField) + .addWhereCondition(allConditions) + .addGroupByField(USERS.ID) + .setPageSize(Integer.toUnsignedLong(parameters.limit())) + .setStatementListener(statement -> { + querySpan.setAttribute(DB_STATEMENT, statement.toString()); + }) + .build() ); return new IdDatabaseUsersQueries.UsersByEmailSearch( diff --git a/com.io7m.idstore.database.postgres/src/main/resources/com/io7m/idstore/database/postgres/internal/database.xml b/com.io7m.idstore.database.postgres/src/main/resources/com/io7m/idstore/database/postgres/internal/database.xml index 8fa5f4ca..4b7cb1d1 100644 --- a/com.io7m.idstore.database.postgres/src/main/resources/com/io7m/idstore/database/postgres/internal/database.xml +++ b/com.io7m.idstore.database.postgres/src/main/resources/com/io7m/idstore/database/postgres/internal/database.xml @@ -3,8 +3,9 @@ - The idstore role is a least-privilege role that can perform only those operations required to run the system and - no others. The role is initially set to "nologin" as a password will be assigned later and logins enabled. + The idstore role is a least-privilege role that can perform only those + operations required to run the system and no others. The role is initially + set to "nologin" as a password will be assigned later and logins enabled. - The idstore_none role is a no-privilege role that cannot perform any actions. + The idstore_none role is a no-privilege role that cannot perform any + actions. - The schema version table stores the current version of the database schema. Implementations are expected to query - this table on connecting to the database in order to ensure that the calling code is compatible with the tables in - the database. + The schema version table stores the current version of the database + schema. Implementations are expected to query this table on connecting to + the database in order to ensure that the calling code is compatible with + the tables in the database. - grant select, insert, update, delete on admins to idstore + grant select, insert, update, delete on admins to idstore + grant select (id) on admins to idstore_none - grant select, insert, update, delete on users to idstore + grant select, insert, update, delete on users to idstore + grant select (id) on users to idstore_none - The emails table stores the set of email addresses used by users/admins. Note that - email addresses *do* have a unique constraint, but it's enforced by a separate index - that determines uniqueness based on the lowercase email address. + The emails table stores the set of email addresses used by users/admins. + Note that email addresses *do* have a unique constraint, but it's enforced + by a separate index that determines uniqueness based on the lowercase + email address. - The email_check_delete trigger enforces the constraint that users must have at least one email address at any - time. + The email_check_delete trigger enforces the constraint that users must + have at least one email address at any time. - The audit table stores a list of auditable events. Who did it? What did they do? When did they do it? + The audit table stores a list of auditable events. Who did it? What did + they do? When did they do it? - grant insert, select, delete on login_history to idstore + grant insert, select, delete on login_history to idstore + - The email_verifications table records the email verification operations in process. A verification has an - associated user/admin, email address, verification token, expiration date, and operation. The operation is a value - of com.io7m.idstore.model.IdEmailVerificationOperation. + The email_verifications table records the email verification operations in + process. A verification has an associated user/admin, email address, + verification token, expiration date, and operation. The operation is a + value of com.io7m.idstore.model.IdEmailVerificationOperation. - grant insert, select, delete on email_verifications to idstore + grant insert, select, delete on email_verifications to idstore + - The bans table records the reason any given account might be banned, and when that ban expires (if it expires). + The bans table records the reason any given account might be banned, and + when that ban expires (if it expires). - grant insert, select, update, delete on bans to idstore + grant insert, select, update, delete on bans to idstore + - The user_password_resets table records the password reset operations in process. A verification - has an associated user, verification token, and expiration date. + The user_password_resets table records the password reset operations in + process. A verification has an associated user, verification token, and + expiration date. - grant insert, select, delete on user_password_resets to idstore + grant insert, select, delete on user_password_resets to idstore + - The idstore_read_only role is a read-only role that can read all data but cannot change anything. - The role is initially set to "nologin" as a password may be assigned later and logins enabled. + The idstore_read_only role is a read-only role that can read all data but + cannot change anything. The role is initially set to "nologin" as a + password may be assigned later and logins enabled. grant select on admins to idstore_read_only grant select on audit to idstore_read_only grant select on bans to idstore_read_only - grant select on email_verifications to idstore_read_only + + grant select on email_verifications to idstore_read_only + grant select on emails to idstore_read_only grant select on login_history to idstore_read_only grant select on schema_version to idstore_read_only grant select on user_ids to idstore_read_only - grant select on user_password_resets to idstore_read_only + + grant select on user_password_resets to idstore_read_only + grant select on users to idstore_read_only diff --git a/com.io7m.idstore.shell.admin/src/main/java/com/io7m/idstore/shell/admin/internal/IdAShellCmdHelp.java b/com.io7m.idstore.shell.admin/src/main/java/com/io7m/idstore/shell/admin/internal/IdAShellCmdHelp.java index fa3b7bc1..8ae16f5f 100644 --- a/com.io7m.idstore.shell.admin/src/main/java/com/io7m/idstore/shell/admin/internal/IdAShellCmdHelp.java +++ b/com.io7m.idstore.shell.admin/src/main/java/com/io7m/idstore/shell/admin/internal/IdAShellCmdHelp.java @@ -24,6 +24,7 @@ import com.io7m.quarrel.core.QCommandTreeResolver.QResolutionOKCommand; import com.io7m.quarrel.core.QCommandTreeResolver.QResolutionOKGroup; import com.io7m.quarrel.core.QCommandTreeResolver.QResolutionRoot; +import com.io7m.quarrel.core.QException; import com.io7m.quarrel.core.QParameterNamedType; import com.io7m.quarrel.core.QParametersPositionalAny; import com.io7m.quarrel.core.QParametersPositionalType; @@ -75,6 +76,7 @@ public QParametersPositionalType onListPositionalParameters() @Override public QCommandStatus onExecute( final QCommandContextType context) + throws QException { final var resolution = QCommandTreeResolver.resolve( diff --git a/pom.xml b/pom.xml index 543c4d18..e17a920a 100644 --- a/pom.xml +++ b/pom.xml @@ -74,22 +74,22 @@ 0.0.8 1.0.2 2.0.0 - 0.0.2 + 0.0.3 0.0.1 2.0.0 - 1.2.0 + 1.3.0 1.0.0 1.0.0 0.0.2 - 1.0.0 + 1.1.0 1.0.0 1.8.0 0.0.1 1.0.0-SNAPSHOT 11.0.15 - 3.18.5 - 1.4.8 - 1.27.0 + 3.18.6 + 1.4.11 + 1.28.0 3.23.0 2.0.7 1.18.3 @@ -439,7 +439,7 @@ com.github.ben-manes.caffeine caffeine - 3.1.6 + 3.1.8 org.checkerframework @@ -473,17 +473,17 @@ io.opentelemetry opentelemetry-sdk-logs - 1.27.0 + 1.28.0 org.jetbrains.kotlin kotlin-stdlib - 1.9.0-RC + 1.9.0 com.squareup.okio okio-jvm - 3.3.0 + 3.5.0 @@ -514,7 +514,7 @@ com.helger ph-css - 7.0.0 + 7.0.1 com.google.code.findbugs @@ -579,22 +579,22 @@ org.junit.jupiter junit-jupiter-api - 5.10.0-M1 + 5.10.0 org.junit.jupiter junit-jupiter-engine - 5.10.0-M1 + 5.10.0 net.jqwik jqwik-api - 1.7.3 + 1.7.4 net.jqwik jqwik-engine - 1.7.3 + 1.7.4 com.io7m.quixote