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

Added console command to encrypt previously unencrypted fields #14385

Merged
merged 3 commits into from
Mar 7, 2024

Conversation

snipe
Copy link
Owner

@snipe snipe commented Mar 7, 2024

This is a request from a customer where they have a lot of data in a custom field that they'd like to convert into an encrypted custom field. This is right now just a one-off console command, but I think we can add options to it down the line, and also possibly have it run the reverse way and convert an encrypted field into an unencrypted field.

Copy link

This pull request has been linked to Shortcut Story #24971: Ability to convert unencrypted fields to encrypted fields.

Copy link

what-the-diff bot commented Mar 7, 2024

PR Summary

  • Introduction of New Console Command File
    A new file named 'ToggleCustomfieldEncryption.php' has been added under the 'app/Console/Commands' directory. This new file contains 71 lines of code.

  • Implementation of New Console Command
    A new console command 'snipeit:customfield-encryption' has been implemented. This is what triggers the execution of the program when needed.

  • Function of the 'Handle' Method
    The new file includes a 'handle' method that executes the action of the console command. This action checks if a custom field (specified by 'db_column_name') is present.

    • If this field exists but isn't encrypted, the method will ensure that the data present within this field in the assets table is encrypted.
    • If the field is already encrypted, an error message will be shown, indicating that the action is unnecessary.
    • If there is no matching field to look for, an error message will indicate that no suitable field was found.

This enhancement is under the App\Console\Commands namespace.

Signed-off-by: snipe <[email protected]>
Copy link
Collaborator

@uberbrady uberbrady left a comment

Choose a reason for hiding this comment

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

This looks great! Nice and clean and straightforward.

@snipe snipe merged commit 806671d into develop Mar 7, 2024
8 checks passed
@snipe snipe deleted the feature/sc-24971_convert_unencrypted_custom_fields branch March 7, 2024 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants