diff --git a/apps/perms/forms/asset_permission.py b/apps/perms/forms/asset_permission.py index c061f8d2a..d0b362a1b 100644 --- a/apps/perms/forms/asset_permission.py +++ b/apps/perms/forms/asset_permission.py @@ -34,7 +34,7 @@ class ActionField(forms.MultipleChoiceField): class AssetPermissionForm(OrgModelForm): - action = ActionField() + actions = ActionField() def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) @@ -73,7 +73,6 @@ class AssetPermissionForm(OrgModelForm): 'system_users': forms.SelectMultiple( attrs={'class': 'select2', 'data-placeholder': _('System user')} ), - 'actions': forms.CheckboxSelectMultiple() } labels = { 'nodes': _("Node"), diff --git a/apps/perms/templates/perms/asset_permission_create_update.html b/apps/perms/templates/perms/asset_permission_create_update.html index f45ef8e0d..5ada7f99b 100644 --- a/apps/perms/templates/perms/asset_permission_create_update.html +++ b/apps/perms/templates/perms/asset_permission_create_update.html @@ -159,7 +159,6 @@ $(document).ready(function () { objectAttrsIsList(data, ['users', 'user_groups', 'system_users', 'nodes', 'assets', 'actions']); objectAttrsIsDatetime(data, ['date_start', 'date_expired']); objectAttrsIsBool(data, ['is_active']); - console.log(data) var props = { url: the_url, data: data, diff --git a/apps/static/js/jumpserver.js b/apps/static/js/jumpserver.js index 1dfa1d5b4..a94b6c64e 100644 --- a/apps/static/js/jumpserver.js +++ b/apps/static/js/jumpserver.js @@ -1082,7 +1082,10 @@ function htmlEscape ( d ) { function objectAttrsIsList(obj, attrs) { attrs.forEach(function (attr) { - if (obj[attr] && !(obj[attr] instanceof Array)){ + if (!obj[attr]){ + obj[attr] = [] + } + else if (obj[attr] && !(obj[attr] instanceof Array)){ obj[attr] = [obj[attr]] } })