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

Restrict Backup Import to Initialization Process and Refactor API Key Handling #3061

Merged
merged 4 commits into from
Feb 25, 2025

Conversation

Ludy87
Copy link
Contributor

@Ludy87 Ludy87 commented Feb 25, 2025

Description of Changes

Please provide a summary of the changes, including:

  • What was changed:

    • Updated the backup import logic in InitialSecuritySetup so that the database backup is only imported during initialization when there are no users present. If no backup exists, the admin user is initialized instead.
    • Refactored the API key addition in UserService by extracting the logic into a private helper method saveUser(Optional<User> user) and added a call to export the database after updating the user's API key.
  • Why the change was made:

    • To prevent accidental or unintended backup imports outside the initialization process, ensuring the system only imports backups when necessary.
    • To improve code clarity and maintainability in the user API key management process, while ensuring that the database state is preserved via an export after key updates.

Closes #3057


Checklist

General

Documentation

UI Changes (if applicable)

  • Screenshots or videos demonstrating the UI changes are attached (e.g., as comments or direct attachments in the PR)

Testing (if applicable)

  • I have tested my changes locally. Refer to the Testing Guide for more details.

@dosubot dosubot bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Feb 25, 2025
@github-actions github-actions bot added Java Pull requests that update Java code Back End Issues related to back-end development Security Security-related issues or pull requests labels Feb 25, 2025
@Frooodle Frooodle merged commit e328833 into Stirling-Tools:main Feb 25, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Back End Issues related to back-end development Java Pull requests that update Java code Security Security-related issues or pull requests size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants