This repository has been archived on 2022-05-05. You can view files and clone it, but cannot push or open issues or pull requests.
userausfall/userausfall/rest_api/confirmations.py

15 lines
464 B
Python

from djeveric import Confirmation
from userausfall.models import User
class ConfidantConfirmation(Confirmation):
def has_permission(self, user: User, resource: User):
return user == resource.confidant_unconfirmed
def is_confirmed(self, resource: User):
return resource.confidant_unconfirmed == resource.confidant
def confirm(self, resource: User):
resource.confidant = resource.confidant_unconfirmed
resource.save()