Merge branch 'dev' of github.com:jumpserver/jumpserver into dev

pull/2944/head^2
ibuler 2019-07-15 14:35:34 +08:00
commit 3ac3581622
3 changed files with 27 additions and 2 deletions

View File

@ -68,7 +68,7 @@
</tr>
<tr>
<td>{% trans 'User group count' %}:</td>
<td><b>{{ object.users.count }}</b></td>
<td><b>{{ object.user_groups.count }}</b></td>
</tr>
<tr>
<td>{% trans 'Asset count' %}:</td>

View File

@ -116,5 +116,28 @@ $(document).ready(function () {
$('#date_start').daterangepicker(dateOptions);
$('#date_expired').daterangepicker(dateOptions);
})
.on("submit", "form", function (evt) {
evt.preventDefault();
var form = $("form");
var data = form.serializeObject();
var method = "POST";
var the_url = '{% url "api-perms:remote-app-permission-list" %}';
var redirect_to = '{% url "perms:remote-app-permission-list" %}';
{% if type == "update" %}
the_url = '{% url "api-perms:remote-app-permission-detail" pk=object.id %}';
method = "PUT";
{% endif %}
objectAttrsIsList(data, ['users', 'user_groups', 'remote_apps']);
objectAttrsIsDatetime(data, ['date_expired', 'date_start']);
objectAttrsIsBool(data, ['is_active']);
var props = {
url:the_url,
data:data,
method:method,
form:form,
redirect_to:redirect_to
};
formSubmit(props);
})
</script>
{% endblock %}

View File

@ -48,6 +48,7 @@ class RemoteAppPermissionCreateView(PermissionsMixin, CreateView):
context = {
'app': _('Perms'),
'action': _('Create RemoteApp permission'),
'type': 'create'
}
kwargs.update(context)
return super().get_context_data(**kwargs)
@ -63,7 +64,8 @@ class RemoteAppPermissionUpdateView(PermissionsMixin, UpdateView):
def get_context_data(self, **kwargs):
context = {
'app': _('Perms'),
'action': _('Update RemoteApp permission')
'action': _('Update RemoteApp permission'),
'type': 'update'
}
kwargs.update(context)
return super().get_context_data(**kwargs)