mirror of
https://github.com/simple-login/app.git
synced 2024-11-16 17:08:30 +01:00
Add AuthorizedAddress model
This commit is contained in:
parent
d6d686c4c3
commit
0830bba218
1 changed files with 19 additions and 0 deletions
|
@ -1812,3 +1812,22 @@ class BatchImport(db.Model, ModelMixin):
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return f"<BatchImport {self.id}>"
|
return f"<BatchImport {self.id}>"
|
||||||
|
|
||||||
|
|
||||||
|
class AuthorizedAddress(db.Model, ModelMixin):
|
||||||
|
"""Authorize other addresses to send emails from aliases that are owned by a mailbox"""
|
||||||
|
|
||||||
|
user_id = db.Column(db.ForeignKey(User.id, ondelete="cascade"), nullable=False)
|
||||||
|
mailbox_id = db.Column(
|
||||||
|
db.ForeignKey(Mailbox.id, ondelete="cascade"), nullable=False
|
||||||
|
)
|
||||||
|
email = db.Column(db.String(256), nullable=False)
|
||||||
|
|
||||||
|
__table_args__ = (
|
||||||
|
db.UniqueConstraint("mailbox_id", "email", name="uq_authorize_address"),
|
||||||
|
)
|
||||||
|
|
||||||
|
mailbox = db.relationship(Mailbox, backref="authorized_addresses")
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return f"<AuthorizedAddress {self.id} {self.email} {self.mailbox_id}>"
|
||||||
|
|
Loading…
Reference in a new issue