mirror of https://github.com/jumpserver/jumpserver
Merge pull request #2942 from jumpserver/remote_app_perms_api
[Update] 创建/更新 远程应用授权 使用apipull/2945/head
commit
13ca70b328
|
@ -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 %}
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue