-
Notifications
You must be signed in to change notification settings - Fork 142
WIP: Add reset password rake task #2807
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
base: master
Are you sure you want to change the base?
Conversation
ea8ef3b to
040c878
Compare
lib/tasks/reset_password.rake
Outdated
| require 'io/console' | ||
|
|
||
| namespace :role do | ||
| desc "Retrieve the API key for the given role" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The description and the task name address two different points (retrieve an API key, reset password). What do you think about combining these two outcomes in the description and task name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, that's actually a copy/paste error from https://github.com/cyberark/conjur/blob/master/lib/tasks/role.rake I overlooked .
I will update this to:
desc "Reset the password and API key for the given role"
WDYT?
| desc "Retrieve the API key for the given role" | ||
| task :"reset-password", [:role_id] => [:environment] do |t, args| | ||
|
|
||
| role = Role.first(role_id: args[:role_id]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of Role, do we want to limit this to `User? If we are keeping this generic, should we skip password setting for hosts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's a good call. I'll update this. Thanks!
|
|
||
| namespace :role do | ||
| desc "Retrieve the API key for the given role" | ||
| task :"reset-password", [:role_id] => [:environment] do |t, args| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Complex method namespace(role)::task#reset-password (61.8)
| namespace :role do | ||
| desc "Retrieve the API key for the given role" | ||
| task :"reset-password", [:role_id] => [:environment] do |t, args| | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra empty line detected at block body beginning.
|
|
||
| namespace :role do | ||
| desc "Retrieve the API key for the given role" | ||
| task :"reset-password", [:role_id] => [:environment] do |t, args| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unused block argument - t. If it's necessary, use _ or _t as an argument name to indicate that it won't be used.
| role.credentials.rotate_api_key | ||
| role.credentials.save | ||
| end | ||
| rescue => err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use e instead of err.
| exit(1) | ||
| end | ||
|
|
||
| password = IO::console.getpass("Enter new password: ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not use :: for method calls.
|
Code Climate has analyzed commit 040c878 and detected 6 issues on this pull request. Here's the issue category breakdown:
The test coverage on the diff in this pull request is 14.2% (50% is the threshold). This pull request will bring the total coverage in the repository to 89.8% (-1.6% change). View more on Code Climate. |
040c878 to
744af77
Compare
744af77 to
8e38d61
Compare
|
It seems like this could be really useful. Any reason it isn't merged? |
6566647 to
d65d499
Compare
d65d499 to
dbea020
Compare
dbea020 to
8031a2a
Compare
Desired Outcome
Please describe the desired outcome for this PR. Said another way, what was
the original request that resulted in these code changes? Feel free to copy
this information from the connected issue.
Implemented Changes
Describe how the desired outcome above has been achieved with this PR. In
particular, consider:
Connected Issue/Story
Resolves #[relevant GitHub issue(s), e.g. 76]
CyberArk internal issue ID: [insert issue ID]
Definition of Done
At least 1 todo must be completed in the sections below for the PR to be
merged.
Changelog
CHANGELOG update
Test coverage
changes, or
Documentation
READMEs) were updated in this PRBehavior
Security