Skip to content

feat: Enhance RemoteServer and Console create-user to assign group#1405

Merged
mergify[bot] merged 6 commits into
ArcadeData:mainfrom
gramian:main
Dec 28, 2023
Merged

feat: Enhance RemoteServer and Console create-user to assign group#1405
mergify[bot] merged 6 commits into
ArcadeData:mainfrom
gramian:main

Conversation

@gramian

@gramian gramian commented Dec 27, 2023

Copy link
Copy Markdown
Collaborator

What does this PR do?

  1. The RemoteServe class method createUser is overloaded with a variant with the signature
public void createUser(final String userName, final String password, final HashMap<String,String> databases)

As for the HTTP API server command the databases HashMap should have keys being database names and values being a group name.
The former function with a List<String> databases argument is still available, but its body changed so that the new method is called by it.

  1. The Console class method executeCreateUser is updated so the new RemoteServer createUser method is used. However not too robustly, and error handling is defered to the RemoteServer or eventually to the ServerSecurityUser class.

So now in console the following can be done:

CREATE USER user IDENTIFIED BY password GRANT CONNECT TO db:group

Motivation

Missing capability to assign group during user creation in console, even though possibl via HTTP API.

Additional Notes

It is possible to pass an empty group, but AFAIK this is also allowed in the HTTP server command.

Checklist

  • I have run the build using mvn clean package command
  • My unit tests cover both failure and success scenarios


final String password;
final List<String> databases;
HashMap<String,String> databases = new HashMap<String,String>();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my suggestion:
final Map<String,String>...

}

public void createUser(final String userName, final String password, final List<String> databases) {
public void createUser(final String userName, final String password, final HashMap<String,String> databases) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again, prefer interface:
final Map<String,String


public void createUser(final String userName, final String password, final List<String> databases) {

HashMap<String,String> databasesWithGroups = new HashMap<String, String>();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

again:
Map<String,String> databasesWithGroups = new HashMap<String, String>();

@lvca lvca added the enhancement New feature or request label Dec 28, 2023
@lvca lvca added this to the 23.12.1 milestone Dec 28, 2023
@lvca

lvca commented Dec 28, 2023

Copy link
Copy Markdown
Member

Good for me ;-)

@robfrank robfrank left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mergify mergify Bot merged commit 6313d89 into ArcadeData:main Dec 28, 2023
mergify Bot added a commit that referenced this pull request Jun 7, 2026
Bumps [neo4j-driver](https://github.com/neo4j/neo4j-javascript-driver) from 6.0.1 to 6.1.0.
Release notes

*Sourced from [neo4j-driver's releases](https://github.com/neo4j/neo4j-javascript-driver/releases).*

> v6.1.0
> ------
>
> Introduces the full, stabilized version of Object Mapping, as well as very simple retries that should make `Session.run()` handle rate-limiting on Aura more gracefully. Alongside a number of minor fixes.
>
> #### ⭐ New Features
>
> ---
>
> * Stabilized Record Object Mapping and introduced Parameter Object Mapping. [#1362](https://github.com/neo4j/neo4j-javascript-driver/pull/1362) [#1407](https://github.com/neo4j/neo4j-javascript-driver/pull/1407) NOTE: A usage guide can be found in the PR description on [#1407](https://github.com/neo4j/neo4j-javascript-driver/pull/1407)
> * Add single-shot retry for Idempotent errors on `Session.run()`, these will currently only trigger on errors caused by Aura rate-limiting. [#1404](https://github.com/neo4j/neo4j-javascript-driver/pull/1404)
>
> #### 🔧 Fixes
>
> ---
>
> * Correct TypeScript exports for Record Object Mapping. [#1359](https://github.com/neo4j/neo4j-javascript-driver/pull/1359)
> * Improve error message for starting work on a busy session. [#1363](https://github.com/neo4j/neo4j-javascript-driver/pull/1363)
> * Fix error handling for unexpected errors in Authentication Provider. [#1366](https://github.com/neo4j/neo4j-javascript-driver/pull/1366)
> * Fix issue causing SNI deprecation warnings when correcting to an IP. [#1369](https://github.com/neo4j/neo4j-javascript-driver/pull/1369)
> * Eagerly send discard on close if connection is waiting to pull more, solves issue related to corner-case missuse that could make the driver release an unclean connection to the pool. [#1403](https://github.com/neo4j/neo4j-javascript-driver/pull/1403)
> * Do not mark Result as consumed when `Result.keys()` is awaited. [#1402](https://github.com/neo4j/neo4j-javascript-driver/pull/1402)
>
> #### 🧹 Housekeeping
>
> ---
>
> * Improve `Session.run()` docs with warnings on the auto-commit nature of the function. [#1389](https://github.com/neo4j/neo4j-javascript-driver/pull/1389) [#1390](https://github.com/neo4j/neo4j-javascript-driver/pull/1390)
> * Update docs reference to dbms.setTXMetaData which is renamed to tx.setMetaData.[#1408](https://github.com/neo4j/neo4j-javascript-driver/pull/1408)


Commits

* [`81f7d82`](neo4j/neo4j-javascript-driver@81f7d82) bump deno to 6.1.0 ([#1421](https://github.com/neo4j/neo4j-javascript-driver/issues/1421))
* [`a06109c`](neo4j/neo4j-javascript-driver@a06109c) Pre-release changes to Object Mapping ([#1407](https://github.com/neo4j/neo4j-javascript-driver/issues/1407))
* [`2595d67`](neo4j/neo4j-javascript-driver@2595d67) Update docs reference to dbms.setTXMetaData ([#1408](https://github.com/neo4j/neo4j-javascript-driver/issues/1408))
* [`18c681a`](neo4j/neo4j-javascript-driver@18c681a) Result.close() send discard directly if waiting for more ([#1403](https://github.com/neo4j/neo4j-javascript-driver/issues/1403))
* [`a98f9c5`](neo4j/neo4j-javascript-driver@a98f9c5) Add retries for idempotent errors on Session.run() ([#1404](https://github.com/neo4j/neo4j-javascript-driver/issues/1404))
* [`d884171`](neo4j/neo4j-javascript-driver@d884171) Development Dependency updates and tightening security ([#1405](https://github.com/neo4j/neo4j-javascript-driver/issues/1405))
* [`6714eba`](neo4j/neo4j-javascript-driver@6714eba) Fix error piping in gulpfile ([#1406](https://github.com/neo4j/neo4j-javascript-driver/issues/1406))
* [`2caa88a`](neo4j/neo4j-javascript-driver@2caa88a) Expand Record Object Mapping to allow Parameter Mapping ([#1362](https://github.com/neo4j/neo4j-javascript-driver/issues/1362))
* [`6357e65`](neo4j/neo4j-javascript-driver@6357e65) do not add "onCompleted" on keys observer ([#1402](https://github.com/neo4j/neo4j-javascript-driver/issues/1402))
* [`1ec186a`](neo4j/neo4j-javascript-driver@1ec186a) TestKit backend: fix BigInt serialization ([#1397](https://github.com/neo4j/neo4j-javascript-driver/issues/1397))
* Additional commits viewable in [compare view](neo4j/neo4j-javascript-driver@6.0.1...6.1.0)

Install script changes

This version modifies `prepare` script that runs during installation. Review the package contents before updating.

  
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility\_score?dependency-name=neo4j-driver&package-manager=npm\_and\_yarn&previous-version=6.0.1&new-version=6.1.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
  
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot show  ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants