Skip to content

Conversation

@mrigsby
Copy link
Contributor

@mrigsby mrigsby commented Jan 20, 2025

Adds ability to include locked = ["dataKeyName"] to a wire that will prevent updating from incoming requests.

Addresses issue #77

  • locked can be set to an array of keys locked = ["dataKeyName","dataKeyTwoName"], a comma seperated list locked = "dataKeyName,dataKeyNameTwo,dataKeyNameThree", or a string with a single key name locked = "dataKeyName"
  • Added _validateLockedProperty() function to models/Component.cfc
  • _validateLockedProperty() is called in the _applyUpdates() while looping over incoming updates and throws exception if updating a locked data property
  • Added six tests
    • should throw a CBWIREException when trying to update a locked property (array)
    • should throw a CBWIREException when trying to update a locked property (list)
    • should throw a CBWIREException when trying to update a locked property (string)
    • should not throw an error when empty array is used for locked property
    • should not throw an error when empty string is used for locked property
    • should not throw an error when data type other than array or string is used for locked property

Similar to livewire, the locked data properties are only prevented from being changed on incoming updates from client.

Copy link
Collaborator

@grantcopley grantcopley 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 really great @mrigsby ! Merging into the development branch and I'll be releasing this as part of version 4.2

@grantcopley grantcopley merged commit dd0dd48 into coldbox-modules:development Jan 20, 2025
3 of 4 checks passed
@mrigsby
Copy link
Contributor Author

mrigsby commented Jan 20, 2025

Thanks @grantcopley , I figured I can get a few things completed. Let me know if there is something specific you would like me to work on.

@grantcopley
Copy link
Collaborator

@mrigsby I've targeted this for the 5.0 release

@grantcopley grantcopley added this to the v5.0 milestone Oct 9, 2025
@mrigsby mrigsby deleted the lockedDataProps branch October 23, 2025 23:35
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.

2 participants