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
371aff32
Unverified
Commit
371aff32
authored
Jul 04, 2019
by
BaiJiangJie
Committed by
GitHub
Jul 04, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Update] 优化用户组列表用户显示问题 (#2882)
parent
bab4326a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
3 deletions
+25
-3
group.py
apps/users/api/group.py
+11
-2
v1.py
apps/users/serializers/v1.py
+13
-0
user_group_list.html
apps/users/templates/users/user_group_list.html
+1
-1
No files found.
apps/users/api/group.py
View file @
371aff32
...
...
@@ -5,8 +5,11 @@ from rest_framework import generics
from
rest_framework_bulk
import
BulkModelViewSet
from
rest_framework.pagination
import
LimitOffsetPagination
from
..serializers
import
UserGroupSerializer
,
\
UserGroupUpdateMemberSerializer
from
..serializers
import
(
UserGroupSerializer
,
UserGroupListSerializer
,
UserGroupUpdateMemberSerializer
,
)
from
..models
import
UserGroup
from
common.permissions
import
IsOrgAdmin
from
common.mixins
import
IDInCacheFilterMixin
...
...
@@ -23,6 +26,12 @@ class UserGroupViewSet(IDInCacheFilterMixin, BulkModelViewSet):
permission_classes
=
(
IsOrgAdmin
,)
pagination_class
=
LimitOffsetPagination
def
get_serializer_class
(
self
):
if
self
.
action
in
(
"list"
,
'retrieve'
)
and
\
self
.
request
.
query_params
.
get
(
"display"
):
return
UserGroupListSerializer
return
self
.
serializer_class
class
UserGroupUpdateUserApi
(
generics
.
RetrieveUpdateAPIView
):
queryset
=
UserGroup
.
objects
.
all
()
...
...
apps/users/serializers/v1.py
View file @
371aff32
...
...
@@ -6,10 +6,19 @@ from rest_framework import serializers
from
common.utils
import
get_signer
,
validate_ssh_public_key
from
common.mixins
import
BulkSerializerMixin
from
common.fields
import
StringManyToManyField
from
common.serializers
import
AdaptedBulkListSerializer
from
orgs.mixins
import
BulkOrgResourceModelSerializer
from
..models
import
User
,
UserGroup
__all__
=
[
'UserSerializer'
,
'UserPKUpdateSerializer'
,
'UserUpdateGroupSerializer'
,
'UserGroupSerializer'
,
'UserGroupListSerializer'
,
'UserGroupUpdateMemberSerializer'
,
'ChangeUserPasswordSerializer'
]
signer
=
get_signer
()
...
...
@@ -108,6 +117,10 @@ class UserGroupSerializer(BulkOrgResourceModelSerializer):
}
class
UserGroupListSerializer
(
UserGroupSerializer
):
users
=
StringManyToManyField
(
many
=
True
,
read_only
=
True
)
class
UserGroupUpdateMemberSerializer
(
serializers
.
ModelSerializer
):
users
=
serializers
.
PrimaryKeyRelatedField
(
many
=
True
,
queryset
=
User
.
objects
.
all
())
...
...
apps/users/templates/users/user_group_list.html
View file @
371aff32
...
...
@@ -79,7 +79,7 @@ function initTable() {
}
}}
],
ajax_url
:
'{% url "api-users:user-group-list" %}'
,
ajax_url
:
'{% url "api-users:user-group-list" %}
?display=1
'
,
columns
:
[{
data
:
function
(){
return
""
}},
{
data
:
"name"
},
{
data
:
"users"
},
{
data
:
"comment"
},
{
data
:
"id"
}],
order
:
[],
...
...
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