Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/onyx-dot-app/onyx into feat…
Browse files Browse the repository at this point in the history
…ure/more_lock_validation
  • Loading branch information
Richard Kuo (Danswer) committed Feb 5, 2025
2 parents 06245fa + 1c12ab3 commit 0a341e2
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 6 deletions.
Empty file removed backend/alembic/__init__.py
Empty file.
3 changes: 2 additions & 1 deletion backend/onyx/server/manage/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,14 @@ def list_all_users(
accepted_page: int | None = None,
slack_users_page: int | None = None,
invited_page: int | None = None,
include_api_keys: bool = False,
_: User | None = Depends(current_curator_or_admin_user),
db_session: Session = Depends(get_session),
) -> AllUsersResponse:
users = [
user
for user in get_all_users(db_session, email_filter_string=q)
if not is_api_key_email_address(user.email)
if (include_api_keys or not is_api_key_email_address(user.email))
]

slack_users = [user for user in users if user.role == UserRole.SLACK_USER]
Expand Down
2 changes: 1 addition & 1 deletion web/src/app/admin/assistants/AssistantEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ export function AssistantEditor({
const [isRequestSuccessful, setIsRequestSuccessful] = useState(false);

const { data: userGroups } = useUserGroups();
// const { data: allUsers } = useUsers() as {
// const { data: allUsers } = useUsers({ includeApiKeys: false }) as {
// data: MinimalUserSnapshot[] | undefined;
// };

Expand Down
2 changes: 1 addition & 1 deletion web/src/app/ee/admin/groups/[groupId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const Page = (props: { params: Promise<{ groupId: string }> }) => {
data: users,
isLoading: userIsLoading,
error: usersError,
} = useUsers();
} = useUsers({ includeApiKeys: true });
const {
data: ccPairs,
isLoading: isCCPairsLoading,
Expand Down
2 changes: 1 addition & 1 deletion web/src/app/ee/admin/groups/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const Main = () => {
data: users,
isLoading: userIsLoading,
error: usersError,
} = useUsers();
} = useUsers({ includeApiKeys: true });

const { isAdmin } = useUser();

Expand Down
8 changes: 6 additions & 2 deletions web/src/lib/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,12 @@ export function useFilters(): FilterManager {
};
}

export const useUsers = () => {
const url = "/api/manage/users";
interface UseUsersParams {
includeApiKeys: boolean;
}

export const useUsers = ({ includeApiKeys }: UseUsersParams) => {
const url = `/api/manage/users?include_api_keys=${includeApiKeys}`;

const swrResponse = useSWR<AllUsersResponse>(url, errorHandlingFetcher);

Expand Down

0 comments on commit 0a341e2

Please sign in to comment.