fairdm.contrib.contributors.services.claiming#
Claiming services that activate an unclaimed person by ORCID, email or token.
Expected, user-facing failures raise ClaimingError. Programmer errors propagate unchanged.
Module Contents#
Functions#
Activate an unclaimed person through an ORCID social login. |
|
Activate an unclaimed person after email verification. |
|
Activate an unclaimed person through a signed claim token. |
API#
- claim_via_orcid(person: fairdm.contrib.contributors.models.Person, sociallogin: allauth.socialaccount.models.SocialLogin) fairdm.contrib.contributors.models.Person[source]#
Activate an unclaimed person through an ORCID social login.
The person is marked claimed and active, the social login is connected to them, and the outcome is written to the claiming audit log, failures included.
Args: person: The unclaimed person to activate. sociallogin: The allauth social login for the ORCID account.
Returns: The now-claimed person.
Raises: ClaimingError: The person is already claimed or deactivated.
- claim_via_email(person: fairdm.contrib.contributors.models.Person) fairdm.contrib.contributors.models.Person | None[source]#
Activate an unclaimed person after email verification.
Does nothing unless
ACCOUNT_EMAIL_VERIFICATIONismandatory, so a signal handler can call it without checking. The outcome is written to the claiming audit log.Args: person: The unclaimed person to activate.
Returns: The now-claimed person, or None when verification is not mandatory.
Raises: ClaimingError: The person is already claimed or deactivated.
- claim_via_token(token_string: str, user: fairdm.contrib.contributors.models.Person) fairdm.contrib.contributors.models.Person[source]#
Activate an unclaimed person through a signed claim token.
This is the simple path, for a user with no conflicting account. Merging two accounts is routed to
merge_personsby the claim view. The outcome is written to the claiming audit log.Args: token_string: The signed token from
generate_claim_token. user: The authenticated person claiming the profile.Returns: The now-claimed person.
Raises: ClaimingError: The token is tampered, expired or already used, or its person is deactivated.