Unverified Commit 303cf41b authored by BaiJiangJie's avatar BaiJiangJie Committed by GitHub

Merge pull request #2887 from jumpserver/dev_bugfix

[Update] 修复授权规则更新失败的bug
parents 423a487b 05129889
...@@ -34,7 +34,7 @@ class ActionField(forms.MultipleChoiceField): ...@@ -34,7 +34,7 @@ class ActionField(forms.MultipleChoiceField):
class AssetPermissionForm(OrgModelForm): class AssetPermissionForm(OrgModelForm):
action = ActionField() actions = ActionField()
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
...@@ -73,7 +73,6 @@ class AssetPermissionForm(OrgModelForm): ...@@ -73,7 +73,6 @@ class AssetPermissionForm(OrgModelForm):
'system_users': forms.SelectMultiple( 'system_users': forms.SelectMultiple(
attrs={'class': 'select2', 'data-placeholder': _('System user')} attrs={'class': 'select2', 'data-placeholder': _('System user')}
), ),
'actions': forms.CheckboxSelectMultiple()
} }
labels = { labels = {
'nodes': _("Node"), 'nodes': _("Node"),
......
...@@ -159,7 +159,6 @@ $(document).ready(function () { ...@@ -159,7 +159,6 @@ $(document).ready(function () {
objectAttrsIsList(data, ['users', 'user_groups', 'system_users', 'nodes', 'assets', 'actions']); objectAttrsIsList(data, ['users', 'user_groups', 'system_users', 'nodes', 'assets', 'actions']);
objectAttrsIsDatetime(data, ['date_start', 'date_expired']); objectAttrsIsDatetime(data, ['date_start', 'date_expired']);
objectAttrsIsBool(data, ['is_active']); objectAttrsIsBool(data, ['is_active']);
console.log(data)
var props = { var props = {
url: the_url, url: the_url,
data: data, data: data,
......
...@@ -1082,7 +1082,10 @@ function htmlEscape ( d ) { ...@@ -1082,7 +1082,10 @@ function htmlEscape ( d ) {
function objectAttrsIsList(obj, attrs) { function objectAttrsIsList(obj, attrs) {
attrs.forEach(function (attr) { 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]] obj[attr] = [obj[attr]]
} }
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment