mirror of
https://github.com/netbox-community/netbox.git
synced 2025-12-10 18:39:36 -06:00
fix(users): Normalize actions in cloned objects init
Some checks are pending
CI / build (20.x, 3.10) (push) Waiting to run
CI / build (20.x, 3.11) (push) Waiting to run
CI / build (20.x, 3.12) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, actions) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, python) (push) Waiting to run
Some checks are pending
CI / build (20.x, 3.10) (push) Waiting to run
CI / build (20.x, 3.11) (push) Waiting to run
CI / build (20.x, 3.12) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, actions) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, javascript-typescript) (push) Waiting to run
CodeQL / Analyze (${{ matrix.language }}) (none, python) (push) Waiting to run
Ensure `actions` are consistently normalized to a list of strings during cloned object initialization. This resolves potential type mismatches when processing user form data. Fixes #20750
This commit is contained in:
parent
9723a2f0ad
commit
b5a9cb1762
@ -372,6 +372,9 @@ class ObjectPermissionForm(forms.ModelForm):
|
|||||||
elif self.initial:
|
elif self.initial:
|
||||||
# Handle cloned objects - actions come from initial data (URL parameters)
|
# Handle cloned objects - actions come from initial data (URL parameters)
|
||||||
if 'actions' in self.initial:
|
if 'actions' in self.initial:
|
||||||
|
# Normalize actions to a list of strings
|
||||||
|
if isinstance(self.initial['actions'], str):
|
||||||
|
self.initial['actions'] = [self.initial['actions']]
|
||||||
if cloned_actions := self.initial['actions']:
|
if cloned_actions := self.initial['actions']:
|
||||||
for action in ['view', 'add', 'change', 'delete']:
|
for action in ['view', 'add', 'change', 'delete']:
|
||||||
if action in cloned_actions:
|
if action in cloned_actions:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user