Skip to content

Commit

Permalink
add search
Browse files Browse the repository at this point in the history
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
  • Loading branch information
BeryJu committed Jun 13, 2022
1 parent 5db45ca commit 219117e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
13 changes: 10 additions & 3 deletions authentik/core/api/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -478,15 +478,22 @@ def filter_queryset(self, queryset):
200: inline_serializer(
"UserPathSerializer", {"paths": ListField(child=CharField(), read_only=True)}
)
}
},
parameters=[
OpenApiParameter(
name="search",
location=OpenApiParameter.QUERY,
type=OpenApiTypes.STR,
)
]
)
@action(detail=False, pagination_class=None, filter_backends=[])
@action(detail=False, pagination_class=None)
def paths(self, request: Request) -> Response:
"""Get all user paths"""
return Response(
data={
"paths": list(
self.get_queryset()
self.filter_queryset(self.get_queryset())
.values("path")
.distinct()
.order_by("path")
Expand Down
5 changes: 5 additions & 0 deletions schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3402,6 +3402,11 @@ paths:
get:
operationId: core_users_paths_retrieve
description: Get all user paths
parameters:
- in: query
name: search
schema:
type: string
tags:
- core
security:
Expand Down
4 changes: 3 additions & 1 deletion web/src/pages/users/UserListPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,9 @@ export class UserListPage extends TablePage<User> {
<div class="pf-c-card__title">${t`User folders`}</div>
<div class="pf-c-card__body">
${until(
new CoreApi(DEFAULT_CONFIG).coreUsersPathsRetrieve().then((paths) => {
new CoreApi(DEFAULT_CONFIG).coreUsersPathsRetrieve({
search: this.search,
}).then((paths) => {
return html`<ak-treeview
.items=${paths.paths}
path=${this.path}
Expand Down

0 comments on commit 219117e

Please sign in to comment.