feat: support a default expiry for organisation invite links#7869
Open
cloorc wants to merge 1 commit into
Open
feat: support a default expiry for organisation invite links#7869cloorc wants to merge 1 commit into
cloorc wants to merge 1 commit into
Conversation
Invite links (InviteLink) never expire unless an explicit expires_at is provided at creation time, so by default they remain valid indefinitely. This adds an opt-in INVITE_LINK_EXPIRY_DAYS setting: when configured, a newly created invite link without an explicit expires_at defaults to now + INVITE_LINK_EXPIRY_DAYS days. The setting defaults to None, preserving the existing indefinite behaviour, and an explicitly provided expires_at is never overridden. Signed-off-by: Cloorc <wittcnezh@foxmail.com>
|
@cloorc is attempting to deploy a commit to the Flagsmith Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature.Changes
InviteLink.expires_atis nullable and, when left blank, the link neverexpires (
is_expiredreturnsFalsewhileexpires_atisNone). There iscurrently no way for an operator to make invite links expire by default — each
link would have to be created with an explicit
expires_at.This PR adds an opt-in
INVITE_LINK_EXPIRY_DAYSsetting:InviteLinkwithout an explicitexpires_atdefaults to
now + INVITE_LINK_EXPIRY_DAYSdays (applied via aBEFORE_CREATElifecycle hook).None, preserving today's indefinite behaviour, sothis is fully backward compatible.
expires_atis never overridden.How did you test this code?
Added unit tests in
test_unit_invites_models.py:…default_expiry_setting__sets_expires_at— with the setting configured, alink created without an expiry gets
expires_at ≈ now + N days.…no_default_expiry_setting__stays_indefinite— with the setting unset, alink created without an expiry stays
expires_at = None.…explicit_expiry__not_overridden_by_default— an explicitexpires_atispreserved even when the setting is configured.