You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It appears that starting registration creates an auth_user and completing registration creates an api_account. If registrations remain incomplete or users start/finish in odd orders, then those accounts have different ids. This should be fine, since they have a relationship to each other.
(There's a potential separate issue here with the existence of incomplete, unverified user accounts)
However, when creating a new thread, the auth_user id is passed as the author_id of the thread, but the database constraints check if the id exists in api_accounts:
Internal Server Error: /api/new_thread/
IntegrityError at /api/new_thread/
insert or update on table "api_thread" violates foreign key constraint "api=
_thread_author_id_edb902cb_fk_api_account_id"
DETAIL: Key (author_id)=3D(4) is not present in table "api_account".
Request Method: POST
Request URL: http://127.0.0.1:8000/api/new_thread/
In my case, I have 4 users but only 2 of them have completed registration and are valid api_accounts, hence auth_user id 4 but no existing api_account id 4.
What I don't know yet is if the application handles author_id as if it is an auth_user id and the db constraint is incorrect, or passing the auth_user id is invalid and it's going to effectively post a thread on behalf of a completely different api account.
It appears that starting registration creates an
auth_user
and completing registration creates anapi_account
. If registrations remain incomplete or users start/finish in odd orders, then those accounts have different ids. This should be fine, since they have a relationship to each other.(There's a potential separate issue here with the existence of incomplete, unverified user accounts)
However, when creating a new thread, the
auth_user
id is passed as theauthor_id
of the thread, but the database constraints check if the id exists inapi_accounts
:In my case, I have 4 users but only 2 of them have completed registration and are valid
api_accounts
, henceauth_user
id 4 but no existingapi_account
id 4.What I don't know yet is if the application handles
author_id
as if it is anauth_user
id and the db constraint is incorrect, or passing theauth_user
id is invalid and it's going to effectively post a thread on behalf of a completely different api account.Code in question:
https://github.com/CiviWiki/OpenCiviWiki/blob/dev/project/api/write.py#L29
The text was updated successfully, but these errors were encountered: