Skip to content

Commit

Permalink
Saml account fastapi deletion (onyx-dot-app#2512)
Browse files Browse the repository at this point in the history
* saml account fastapi deletion

* update error detail
  • Loading branch information
pablonyx authored and rajiv chodisetti committed Oct 2, 2024
1 parent 7998423 commit d1e35c4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
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 @@ -249,7 +250,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

0 comments on commit d1e35c4

Please sign in to comment.