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

UI/database mssql #11231

Merged
merged 21 commits into from
Apr 14, 2021
Merged

UI/database mssql #11231

merged 21 commits into from
Apr 14, 2021

Conversation

chelshaw
Copy link
Contributor

@chelshaw chelshaw commented Mar 29, 2021

Adds support for MSSQL database secrets engine, adds username template field to connections, and streamlines the process for adding a new database plugins. All you need to do to add a new database type is update two files:

  • models/database/connection.js add to AVAILABLE_PLUGIN_TYPES array with plugin's connection attributes
  • components/database-role-setting-form update STATEMENT_FIELDS if the plugin does not use the default role fields

create-connection
create-role

Testing these changes require a bit of setup, so here are the steps I took to make sure we could connect to a MSSQL database through the UI:

  1. Run MSSQL Docker: docker run -e 'ACCEPT_EULA=Y' -e 'MSSQL_SA_PASSWORD=<YourStrong!Passw0rd>' -p 1401:1433 -d mcr.microsoft.com/mssql/server:2017-latest-ubuntu
  2. Enable database secret engine and create a new connection, with the following details:
connection_url: sqlserver://{{username}}:{{password}}@<your.ip.address>:1401
username: SA
password: <YourStrong!Passw0rd>
  1. Create dynamic role from the new connection, and make sure it has at least one creation statement (examples below)
CREATE LOGIN [{{name}}] WITH PASSWORD = '{{password}}';
CREATE USER [{{name}}] FOR LOGIN [{{name}}];
GRANT SELECT ON SCHEMA::dbo TO [{{name}}]
  1. You should now be able to generate credentials with your new role

@chelshaw chelshaw added the ui label Mar 29, 2021
@chelshaw chelshaw added this to the 1.8 milestone Mar 29, 2021
@chelshaw chelshaw marked this pull request as ready for review April 14, 2021 14:50
@vercel vercel bot temporarily deployed to Preview – vault April 14, 2021 14:54 Inactive
@vercel vercel bot temporarily deployed to Preview – vault-storybook April 14, 2021 15:02 Inactive
],
},
];

/**
* fieldsToGroups helper fn
Copy link
Contributor

Choose a reason for hiding this comment

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

any chance this would be a good candidate for a helper? e.g. could this be used elsewhere, or is this pretty specific to this model?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not exactly, since it's pretty specific to the shape of the object defined above, AVAILABLE_PLUGIN_TYPES. If we use that pattern in the future, we could definitely move it to a shared helper

@@ -95,7 +95,7 @@
@roleType={{@model.type}}
@model={{@model}}
@mode={{@mode}}
@dbType={{this.databaseType}}
@dbType={{await this.databaseType}}
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm all about adding this helper with ember-promise-helpers. I think you were there for the ui-guild meeting where we discussed the argument against having promises in templates but I think we have enough use cases for it. Happy to see it implemented!

Copy link
Contributor

@Monkeychip Monkeychip left a comment

Choose a reason for hiding this comment

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

Looks great, aside for some test failures that are component field-value test failures. I first noticed they said PKI and KMIP, but I don't think they're failing because they're flaky. I think it might be something with the form-field changes that were made, but that's only a guess.

@hashishaw hashishaw merged commit 89bc008 into master Apr 14, 2021
@hashishaw hashishaw deleted the ui/database-mssql branch April 14, 2021 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants