Skip to content

Conversation

Eeshu-Yadav
Copy link
Contributor

Description

This PR makes the organization field readonly for existing RadiusBatch objects in both the admin interface and REST API, addressing issue #609.

When the batch user creation object has been created, there's no point in changing the organization field, and this change disallows modification to maintain data integrity.

Changes

Admin Interface

  • Modified RadiusBatchAdmin.get_readonly_fields() to include organization field for existing objects
  • Organization field remains editable when creating new RadiusBatch objects
  • Added comprehensive tests to verify readonly behavior

REST API

  • Created RadiusBatchUpdateSerializer with organization as readonly field
  • Added BatchUpdateView for handling batch detail operations (retrieve/update)
  • Added URL pattern for batch detail endpoint (/radius/batch/<uuid:pk>/)
  • Added API tests to verify organization field cannot be modified via API

Testing

  • Admin tests: test_radiusbatch_organization_readonly_for_existing_objects
  • Admin tests: test_radiusbatch_organization_editable_for_new_objects
  • API tests: test_batch_update_organization_readonly
  • API tests: test_batch_retrieve_and_update_api
  • API tests: test_batch_update_permissions

Checklist

  • The code follows the project's coding standards
  • Tests have been added/updated to cover the changes
  • All tests are passing
  • The change addresses the issue requirements
  • Backward compatibility is maintained (organization field still editable for new objects)

Fixes #609

@Eeshu-Yadav Eeshu-Yadav force-pushed the issues/609-batch-user-org-field-readonly branch from 017eddb to b5023ad Compare August 22, 2025 18:40
@Eeshu-Yadav
Copy link
Contributor Author

@pandafy kindly review this

@nemesifier
Copy link
Member

@Eeshu-Yadav what's the point of reviewing if you don't follow up?

Please follow up with #621.

@Eeshu-Yadav Eeshu-Yadav force-pushed the issues/609-batch-user-org-field-readonly branch from b5023ad to 1c7eba9 Compare August 22, 2025 21:55
@Eeshu-Yadav
Copy link
Contributor Author

@Eeshu-Yadav what's the point of reviewing if you don't follow up?

Please follow up with #621.

ok

@Eeshu-Yadav Eeshu-Yadav force-pushed the issues/609-batch-user-org-field-readonly branch 5 times, most recently from 32a11b8 to 7ba30e3 Compare August 22, 2025 22:42
…wisp#609

This change prevents modification of the organization field for existing
RadiusBatch objects in both admin interface and REST API. When editing
existing batch objects, the organization field is now readonly to maintain
data integrity and prevent accidental organization changes.

Changes:
- Added organization field to readonly_fields in RadiusBatchAdmin for existing objects
- Created RadiusBatchUpdateSerializer with organization as readonly field
- Added BatchUpdateView for handling batch detail API operations
- Added comprehensive tests for both admin and API readonly functionality

Fixes openwisp#609
@Eeshu-Yadav Eeshu-Yadav force-pushed the issues/609-batch-user-org-field-readonly branch from 7ba30e3 to 1402441 Compare August 23, 2025 08:04
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.

[change] Make batch user creation field readonly in admin and REST API for existing objects
2 participants