Merge pull request #2887 from jumpserver/dev_bugfix

[Update] 修复授权规则更新失败的bug
pull/2890/head
BaiJiangJie 5 years ago committed by GitHub
commit 303cf41bb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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"),

@ -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,

@ -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]]
}
})

Loading…
Cancel
Save