View Source Plausible.Auth.GracePeriod (Plausible v0.0.1)

This embedded schema stores information about the account locking grace period.

Users are given this 7-day grace period to upgrade their account after outgrowing their subscriptions. The actual account locking happens in background with Plausible.Workers.LockSites.

The grace period can also be manual, without an end date, being controlled manually from the CRM, and not by the background site locker job. This is useful for enterprise subscriptions.

Summary

Functions

Returns whether the grace period is still active for a User. Defaults to false if the user is nil or there is no grace period.

Ends an existing grace period by setting users.grace_period.is_over to true. This means the grace period has expired.

Returns whether the grace period has already expired for a User. Defaults to false if the user is nil or there is no grace period.

Removes the grace period from the User completely.

Starts a account locking grace period of 7 days by changing the User struct.

Starts a manual account locking grace period by changing the User struct. Manual locking means the grace period can only be removed manually from the CRM.

Types

@type t() :: %Plausible.Auth.GracePeriod{
  end_date: Date.t() | nil,
  id: term(),
  is_over: boolean(),
  manual_lock: boolean()
}

Functions

Returns whether the grace period is still active for a User. Defaults to false if the user is nil or there is no grace period.

@spec end_changeset(Plausible.Auth.User.t()) :: Ecto.Changeset.t()

Ends an existing grace period by setting users.grace_period.is_over to true. This means the grace period has expired.

@spec expired?(Plausible.Auth.User.t() | Plausible.Teams.Team.t() | nil) :: boolean()

Returns whether the grace period has already expired for a User. Defaults to false if the user is nil or there is no grace period.

@spec remove_changeset(Plausible.Auth.User.t()) :: Ecto.Changeset.t()

Removes the grace period from the User completely.

@spec start_changeset(Plausible.Auth.User.t()) :: Ecto.Changeset.t()

Starts a account locking grace period of 7 days by changing the User struct.

Link to this function

start_manual_lock_changeset(user)

View Source
@spec start_manual_lock_changeset(Plausible.Auth.User.t()) :: Ecto.Changeset.t()

Starts a manual account locking grace period by changing the User struct. Manual locking means the grace period can only be removed manually from the CRM.