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
dda34cb1
Commit
dda34cb1
authored
Aug 09, 2019
by
ibuler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 修改使用Orgmodel view set
parent
4e85dd1d
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
11 additions
and
13 deletions
+11
-13
remote_app.py
apps/applications/api/remote_app.py
+2
-2
asset.py
apps/assets/api/asset.py
+0
-1
cmd_filter.py
apps/assets/api/cmd_filter.py
+3
-3
domain.py
apps/assets/api/domain.py
+3
-3
settings.py
apps/jumpserver/settings.py
+1
-1
group.py
apps/users/api/group.py
+2
-3
No files found.
apps/applications/api/remote_app.py
View file @
dda34cb1
...
@@ -3,8 +3,8 @@
...
@@ -3,8 +3,8 @@
from
rest_framework
import
generics
from
rest_framework
import
generics
from
rest_framework_bulk
import
BulkModelViewSet
from
orgs.mixins
import
OrgBulkModelViewSet
from
..hands
import
IsOrgAdmin
,
IsAppUser
from
..hands
import
IsOrgAdmin
,
IsAppUser
from
..models
import
RemoteApp
from
..models
import
RemoteApp
from
..serializers
import
RemoteAppSerializer
,
RemoteAppConnectionInfoSerializer
from
..serializers
import
RemoteAppSerializer
,
RemoteAppConnectionInfoSerializer
...
@@ -15,7 +15,7 @@ __all__ = [
...
@@ -15,7 +15,7 @@ __all__ = [
]
]
class
RemoteAppViewSet
(
BulkModelViewSet
):
class
RemoteAppViewSet
(
Org
BulkModelViewSet
):
filter_fields
=
(
'name'
,)
filter_fields
=
(
'name'
,)
search_fields
=
filter_fields
search_fields
=
filter_fields
permission_classes
=
(
IsOrgAdmin
,)
permission_classes
=
(
IsOrgAdmin
,)
...
...
apps/assets/api/asset.py
View file @
dda34cb1
...
@@ -91,7 +91,6 @@ class AssetViewSet(LabelFilter, OrgBulkModelViewSet):
...
@@ -91,7 +91,6 @@ class AssetViewSet(LabelFilter, OrgBulkModelViewSet):
return
queryset
return
queryset
class
AssetRefreshHardwareApi
(
generics
.
RetrieveAPIView
):
class
AssetRefreshHardwareApi
(
generics
.
RetrieveAPIView
):
"""
"""
Refresh asset hardware info
Refresh asset hardware info
...
...
apps/assets/api/cmd_filter.py
View file @
dda34cb1
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
#
#
from
rest_framework_bulk
import
BulkModelViewSet
from
django.shortcuts
import
get_object_or_404
from
django.shortcuts
import
get_object_or_404
from
orgs.mixins
import
OrgBulkModelViewSet
from
..hands
import
IsOrgAdmin
from
..hands
import
IsOrgAdmin
from
..models
import
CommandFilter
,
CommandFilterRule
from
..models
import
CommandFilter
,
CommandFilterRule
from
..
import
serializers
from
..
import
serializers
...
@@ -12,7 +12,7 @@ from .. import serializers
...
@@ -12,7 +12,7 @@ from .. import serializers
__all__
=
[
'CommandFilterViewSet'
,
'CommandFilterRuleViewSet'
]
__all__
=
[
'CommandFilterViewSet'
,
'CommandFilterRuleViewSet'
]
class
CommandFilterViewSet
(
BulkModelViewSet
):
class
CommandFilterViewSet
(
Org
BulkModelViewSet
):
filter_fields
=
(
"name"
,)
filter_fields
=
(
"name"
,)
search_fields
=
filter_fields
search_fields
=
filter_fields
permission_classes
=
(
IsOrgAdmin
,)
permission_classes
=
(
IsOrgAdmin
,)
...
@@ -20,7 +20,7 @@ class CommandFilterViewSet(BulkModelViewSet):
...
@@ -20,7 +20,7 @@ class CommandFilterViewSet(BulkModelViewSet):
serializer_class
=
serializers
.
CommandFilterSerializer
serializer_class
=
serializers
.
CommandFilterSerializer
class
CommandFilterRuleViewSet
(
BulkModelViewSet
):
class
CommandFilterRuleViewSet
(
Org
BulkModelViewSet
):
filter_fields
=
(
"content"
,)
filter_fields
=
(
"content"
,)
search_fields
=
filter_fields
search_fields
=
filter_fields
permission_classes
=
(
IsOrgAdmin
,)
permission_classes
=
(
IsOrgAdmin
,)
...
...
apps/assets/api/domain.py
View file @
dda34cb1
# ~*~ coding: utf-8 ~*~
# ~*~ coding: utf-8 ~*~
from
rest_framework_bulk
import
BulkModelViewSet
from
rest_framework.views
import
APIView
,
Response
from
rest_framework.views
import
APIView
,
Response
from
django.views.generic.detail
import
SingleObjectMixin
from
django.views.generic.detail
import
SingleObjectMixin
from
common.utils
import
get_logger
from
common.utils
import
get_logger
from
common.permissions
import
IsOrgAdmin
,
IsOrgAdminOrAppUser
from
common.permissions
import
IsOrgAdmin
,
IsOrgAdminOrAppUser
from
orgs.mixins
import
OrgBulkModelViewSet
from
..models
import
Domain
,
Gateway
from
..models
import
Domain
,
Gateway
from
..
import
serializers
from
..
import
serializers
...
@@ -14,7 +14,7 @@ logger = get_logger(__file__)
...
@@ -14,7 +14,7 @@ logger = get_logger(__file__)
__all__
=
[
'DomainViewSet'
,
'GatewayViewSet'
,
"GatewayTestConnectionApi"
]
__all__
=
[
'DomainViewSet'
,
'GatewayViewSet'
,
"GatewayTestConnectionApi"
]
class
DomainViewSet
(
BulkModelViewSet
):
class
DomainViewSet
(
Org
BulkModelViewSet
):
queryset
=
Domain
.
objects
.
all
()
queryset
=
Domain
.
objects
.
all
()
permission_classes
=
(
IsOrgAdmin
,)
permission_classes
=
(
IsOrgAdmin
,)
serializer_class
=
serializers
.
DomainSerializer
serializer_class
=
serializers
.
DomainSerializer
...
@@ -34,7 +34,7 @@ class DomainViewSet(BulkModelViewSet):
...
@@ -34,7 +34,7 @@ class DomainViewSet(BulkModelViewSet):
return
super
()
.
get_permissions
()
return
super
()
.
get_permissions
()
class
GatewayViewSet
(
BulkModelViewSet
):
class
GatewayViewSet
(
Org
BulkModelViewSet
):
filter_fields
=
(
"domain__name"
,
"name"
,
"username"
,
"ip"
,
"domain"
)
filter_fields
=
(
"domain__name"
,
"name"
,
"username"
,
"ip"
,
"domain"
)
search_fields
=
filter_fields
search_fields
=
filter_fields
queryset
=
Gateway
.
objects
.
all
()
queryset
=
Gateway
.
objects
.
all
()
...
...
apps/jumpserver/settings.py
View file @
dda34cb1
...
@@ -398,7 +398,7 @@ REST_FRAMEWORK = {
...
@@ -398,7 +398,7 @@ REST_FRAMEWORK = {
'SEARCH_PARAM'
:
"search"
,
'SEARCH_PARAM'
:
"search"
,
'DATETIME_FORMAT'
:
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S
%
z'
,
'DATETIME_FORMAT'
:
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S
%
z'
,
'DATETIME_INPUT_FORMATS'
:
[
'iso-8601'
,
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S
%
z'
],
'DATETIME_INPUT_FORMATS'
:
[
'iso-8601'
,
'
%
Y-
%
m-
%
d
%
H:
%
M:
%
S
%
z'
],
#
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',
'DEFAULT_PAGINATION_CLASS'
:
'rest_framework.pagination.LimitOffsetPagination'
,
# 'PAGE_SIZE': 15
# 'PAGE_SIZE': 15
}
}
...
...
apps/users/api/group.py
View file @
dda34cb1
...
@@ -2,7 +2,6 @@
...
@@ -2,7 +2,6 @@
#
#
from
rest_framework
import
generics
from
rest_framework
import
generics
from
rest_framework_bulk
import
BulkModelViewSet
from
..serializers
import
(
from
..serializers
import
(
UserGroupSerializer
,
UserGroupSerializer
,
...
@@ -10,14 +9,14 @@ from ..serializers import (
...
@@ -10,14 +9,14 @@ from ..serializers import (
UserGroupUpdateMemberSerializer
,
UserGroupUpdateMemberSerializer
,
)
)
from
..models
import
UserGroup
from
..models
import
UserGroup
from
orgs.mixins
import
OrgBulkModelViewSet
from
common.permissions
import
IsOrgAdmin
from
common.permissions
import
IsOrgAdmin
from
common.mixins
import
IDInCacheFilterMixin
__all__
=
[
'UserGroupViewSet'
,
'UserGroupUpdateUserApi'
]
__all__
=
[
'UserGroupViewSet'
,
'UserGroupUpdateUserApi'
]
class
UserGroupViewSet
(
IDInCacheFilterMixin
,
BulkModelViewSet
):
class
UserGroupViewSet
(
Org
BulkModelViewSet
):
filter_fields
=
(
"name"
,)
filter_fields
=
(
"name"
,)
search_fields
=
filter_fields
search_fields
=
filter_fields
queryset
=
UserGroup
.
objects
.
all
()
queryset
=
UserGroup
.
objects
.
all
()
...
...
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