Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
J
jumpserver
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ops
jumpserver
Commits
cc7ce044
Commit
cc7ce044
authored
Jul 15, 2019
by
jym503558564
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 创建/更新 远程应用授权 使用api
parent
55b049c8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
1 deletion
+27
-1
remote_app_permission_create_update.html
.../templates/perms/remote_app_permission_create_update.html
+24
-0
remote_app_permission.py
apps/perms/views/remote_app_permission.py
+3
-1
No files found.
apps/perms/templates/perms/remote_app_permission_create_update.html
View file @
cc7ce044
...
@@ -116,5 +116,28 @@ $(document).ready(function () {
...
@@ -116,5 +116,28 @@ $(document).ready(function () {
$
(
'#date_start'
).
daterangepicker
(
dateOptions
);
$
(
'#date_start'
).
daterangepicker
(
dateOptions
);
$
(
'#date_expired'
).
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>
</script>
{% endblock %}
{% endblock %}
\ No newline at end of file
apps/perms/views/remote_app_permission.py
View file @
cc7ce044
...
@@ -48,6 +48,7 @@ class RemoteAppPermissionCreateView(PermissionsMixin, CreateView):
...
@@ -48,6 +48,7 @@ class RemoteAppPermissionCreateView(PermissionsMixin, CreateView):
context
=
{
context
=
{
'app'
:
_
(
'Perms'
),
'app'
:
_
(
'Perms'
),
'action'
:
_
(
'Create RemoteApp permission'
),
'action'
:
_
(
'Create RemoteApp permission'
),
'type'
:
'create'
}
}
kwargs
.
update
(
context
)
kwargs
.
update
(
context
)
return
super
()
.
get_context_data
(
**
kwargs
)
return
super
()
.
get_context_data
(
**
kwargs
)
...
@@ -63,7 +64,8 @@ class RemoteAppPermissionUpdateView(PermissionsMixin, UpdateView):
...
@@ -63,7 +64,8 @@ class RemoteAppPermissionUpdateView(PermissionsMixin, UpdateView):
def
get_context_data
(
self
,
**
kwargs
):
def
get_context_data
(
self
,
**
kwargs
):
context
=
{
context
=
{
'app'
:
_
(
'Perms'
),
'app'
:
_
(
'Perms'
),
'action'
:
_
(
'Update RemoteApp permission'
)
'action'
:
_
(
'Update RemoteApp permission'
),
'type'
:
'update'
}
}
kwargs
.
update
(
context
)
kwargs
.
update
(
context
)
return
super
()
.
get_context_data
(
**
kwargs
)
return
super
()
.
get_context_data
(
**
kwargs
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment