This repository has been archived on 2022-05-05. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
userausfall/userausfall/rest_api/confirmations.py

14 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()