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

Fixed #13396 - do not allow checkout to undeployable status types #15547

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

snipe
Copy link
Owner

@snipe snipe commented Sep 24, 2024

This fixes a validation issue in the API where you could technically check out assets on creation even if the status label is an undeployable type.

Fixes #13396 (sort of - that part was handled a long time ago, this handled a bug reported in that issue via @StarlessNights related to the API allowing assets to be checked out to users, locations, etc even if the status label type is undeployable.)

Copy link

what-the-diff bot commented Sep 24, 2024

PR Summary

  • Enhanced Checkout Validation: Introduced a new rule named AssetCannotBeCheckedOutToNondeployableStatus that restricts the checkout of assets that are not ready for deployment.
  • Improved Asset Request Management: Applied the new rule in StoreAssetRequest context, boosting the system's robustness by preventing any invalid attempts to checkout non-deployable assets.
  • Better Date Comparisons: In Asset.php, the methodology to compare dates has been improved, specifically in the checkInvalidNextAuditDate method for accurate validation of audit dates, helping to avoid any audit-related inaccuracies.
  • Updated Format in Hardware View: Made changes in the hardware view's format for last_audit_date and audit_log.created_at, aligning them with a date-time format. It will help maintain uniformity in how these times are presented in the hardware view.
  • Improved Test Environment: In StoreAssetTest.php, multiple test setups are updated to use readyToDeploy status while creating assets rather than a generic status, making testing scenarios more realistic and reliable.
  • Extended Test Coverage: Added new tests focusing on verifying validation errors when assets in certain non-deployable statuses are attempted to be saved. These new tests will aid in early-stage error identification and overall system reliability.

@StarlessNights
Copy link
Contributor

StarlessNights commented Sep 25, 2024

Tested in the dev.docker-compose.yml environment. An error is returned correctly for all checkout-on-creation API requests I can think of 👍 (with archived/undeployable status labels that is)

@snipe snipe merged commit cb6e504 into develop Sep 25, 2024
8 of 9 checks passed
@snipe snipe deleted the disallow_checkout_with_nondeployable_status branch January 17, 2025 15:18
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.

2 participants