Skip to content

Commit

Permalink
enterprise: fix read_only activating when no license is installed (#8697
Browse files Browse the repository at this point in the history
)

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
  • Loading branch information
BeryJu committed Feb 26, 2024
1 parent 5b6b059 commit 7359057
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions authentik/enterprise/license.py
Expand Up @@ -188,20 +188,21 @@ def last_valid_date() -> datetime:

def summary(self) -> LicenseSummary:
"""Summary of license status"""
has_license = License.objects.all().count() > 0
last_valid = LicenseKey.last_valid_date()
show_admin_warning = last_valid < now() - timedelta(weeks=2)
show_user_warning = last_valid < now() - timedelta(weeks=4)
read_only = last_valid < now() - timedelta(weeks=6)
latest_valid = datetime.fromtimestamp(self.exp)
return LicenseSummary(
show_admin_warning=show_admin_warning,
show_user_warning=show_user_warning,
read_only=read_only,
show_admin_warning=show_admin_warning and has_license,
show_user_warning=show_user_warning and has_license,
read_only=read_only and has_license,
latest_valid=latest_valid,
internal_users=self.internal_users,
external_users=self.external_users,
valid=self.is_valid(),
has_license=License.objects.all().count() > 0,
has_license=has_license,
)

@staticmethod
Expand Down

0 comments on commit 7359057

Please sign in to comment.