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

[ENH] SQL: save user name and password via credentials manager #2403

Merged
merged 3 commits into from
Jul 10, 2017
Merged

[ENH] SQL: save user name and password via credentials manager #2403

merged 3 commits into from
Jul 10, 2017

Conversation

jerneju
Copy link
Contributor

@jerneju jerneju commented Jun 14, 2017

Issue

User name and password should not be saved in Settings.

Description of changes

Use credentials manager.

Includes
  • Code changes
  • Tests
  • Documentation

@codecov-io
Copy link

codecov-io commented Jun 14, 2017

Codecov Report

Merging #2403 into master will decrease coverage by 0.02%.
The diff coverage is 31.25%.

@@            Coverage Diff            @@
##           master   #2403      +/-   ##
=========================================
- Coverage   74.33%   74.3%   -0.03%     
=========================================
  Files         321     321              
  Lines       55988   56011      +23     
=========================================
+ Hits        41616   41621       +5     
- Misses      14372   14390      +18

@astaric
Copy link
Member

astaric commented Jun 14, 2017

Not sure how this is supposed to work since username/password depend on the server/database.

To reproduce, create a workflow that connects to two databases using different credentials. Save it, reload it and see what happens.

@jerneju
Copy link
Contributor Author

jerneju commented Jun 14, 2017

@astaric: Well, besides username and password also server name/address/other could be saved. And not just one, more of them.

kernc
kernc previously requested changes Jun 14, 2017
@@ -50,12 +51,15 @@ class OWSql(OWWidget):
want_main_area = False
resizing_enabled = False

cm_sql_username = CredentialManager("SQL username")
cm_sql_password = CredentialManager("SQL password")
Copy link
Contributor

@kernc kernc Jun 14, 2017

Choose a reason for hiding this comment

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

Could this be, as per CredentialManager docstring, a single cm = CredentialManager('SQL Table') line, further below used as self.cm.username, self.cm.password?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What about "SQL Table: {}:{}".format(self.host, self.port)

@kernc
Copy link
Contributor

kernc commented Jun 14, 2017

In that case, cm would need to be constructed per input values: cm = CredentialManager('SQL - Table - {hostname}:{port}'.format(...)). Credentials wouldn't propagate with saved workflows.

What's the issue with Settings again?

@kernc kernc dismissed their stale review June 14, 2017 13:03

The comment is still valid.

@jerneju
Copy link
Contributor Author

jerneju commented Jun 14, 2017

@kernc

What's the issue with Settings again?

Error reporting sends workflow with that information.

@jerneju jerneju changed the title [WIP][ENH] SQL: save user name and password via credentials manager [ENH] SQL: save user name and password via credentials manager Jun 21, 2017
@astaric
Copy link
Member

astaric commented Jun 29, 2017

Looks ok to me. Could you also add a migration that moves credentials from widget to Credentials Manager (it will be used when loading an old workflow).

Bonus points if you add some tests :)

@@ -55,8 +55,8 @@ class Outputs:
port = Setting(None)
database = Setting(None)
schema = Setting(None)
username = ""
password = ""
username = Setting(None)
Copy link
Member

Choose a reason for hiding this comment

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

What about adding a migrate_settings (class) method and storing the username and password to credentials manager there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I will do that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@astaric astaric merged commit cc063e2 into biolab:master Jul 10, 2017
@jerneju jerneju deleted the credentials-sql branch July 10, 2017 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants