Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Saml account fastapi deletion #2512

Merged
merged 2 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion backend/danswer/server/manage/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
from danswer.db.models import AccessToken
from danswer.db.models import DocumentSet__User
from danswer.db.models import Persona__User
from danswer.db.models import SamlAccount
from danswer.db.models import User
from danswer.db.models import User__UserGroup
from danswer.db.users import get_user_by_email
Expand Down Expand Up @@ -248,7 +249,9 @@ async def delete_user(
db_session=db_session,
user_id=user_to_delete.id,
)

db_session.query(SamlAccount).filter(
SamlAccount.user_id == user_to_delete.id
).delete()
db_session.query(DocumentSet__User).filter(
DocumentSet__User.user_id == user_to_delete.id
).delete()
Expand Down
3 changes: 2 additions & 1 deletion web/src/components/admin/users/SignedUpUserTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ const DeactivaterButton = ({
type: "success",
});
},
onError: (errorMsg) => setPopup({ message: errorMsg, type: "error" }),
onError: (errorMsg) =>
setPopup({ message: errorMsg.message, type: "error" }),
}
);
return (
Expand Down
1 change: 1 addition & 0 deletions web/src/lib/admin/users/userMutationFetcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const userMutationFetcher = async (
body: JSON.stringify(body),
}).then(async (res) => {
if (res.ok) return res.json();

const errorDetail = (await res.json()).detail;
throw Error(errorDetail);
});
Expand Down
Loading