-
-
Notifications
You must be signed in to change notification settings - Fork 917
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enterprise: UI improvements, better handling of expiry (#10828)
* web/admin: show enterprise banner on the very top Signed-off-by: Jens Langhammer <[email protected]> * rework license Signed-off-by: Jens Langhammer <[email protected]> * fix a bunch of things Signed-off-by: Jens Langhammer <[email protected]> * add some more tests Signed-off-by: Jens Langhammer <[email protected]> * add more tests Signed-off-by: Jens Langhammer <[email protected]> * fix middleware Signed-off-by: Jens Langhammer <[email protected]> * better api Signed-off-by: Jens Langhammer <[email protected]> * format Signed-off-by: Jens Langhammer <[email protected]> * add tests for and fix read only mode Signed-off-by: Jens Langhammer <[email protected]> * field name consistency Signed-off-by: Jens Langhammer <[email protected]> --------- Signed-off-by: Jens Langhammer <[email protected]>
- Loading branch information
Showing
20 changed files
with
750 additions
and
195 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
68 changes: 68 additions & 0 deletions
68
authentik/enterprise/migrations/0003_remove_licenseusage_within_limits_and_more.py
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# Generated by Django 5.0.8 on 2024-08-08 14:15 | ||
|
||
from django.db import migrations, models | ||
from django.apps.registry import Apps | ||
from django.db.backends.base.schema import BaseDatabaseSchemaEditor | ||
|
||
|
||
def migrate_license_usage(apps: Apps, schema_editor: BaseDatabaseSchemaEditor): | ||
LicenseUsage = apps.get_model("authentik_enterprise", "licenseusage") | ||
db_alias = schema_editor.connection.alias | ||
|
||
for usage in LicenseUsage.objects.using(db_alias).all(): | ||
usage.status = "valid" if usage.within_limits else "limit_exceeded_admin" | ||
usage.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("authentik_enterprise", "0002_rename_users_license_internal_users_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="licenseusage", | ||
name="status", | ||
field=models.TextField( | ||
choices=[ | ||
("unlicensed", "Unlicensed"), | ||
("valid", "Valid"), | ||
("expired", "Expired"), | ||
("expiry_soon", "Expiry Soon"), | ||
("limit_exceeded_admin", "Limit Exceeded Admin"), | ||
("limit_exceeded_user", "Limit Exceeded User"), | ||
("read_only", "Read Only"), | ||
], | ||
default=None, | ||
null=True, | ||
), | ||
preserve_default=False, | ||
), | ||
migrations.RunPython(migrate_license_usage), | ||
migrations.RemoveField( | ||
model_name="licenseusage", | ||
name="within_limits", | ||
), | ||
migrations.AlterField( | ||
model_name="licenseusage", | ||
name="status", | ||
field=models.TextField( | ||
choices=[ | ||
("unlicensed", "Unlicensed"), | ||
("valid", "Valid"), | ||
("expired", "Expired"), | ||
("expiry_soon", "Expiry Soon"), | ||
("limit_exceeded_admin", "Limit Exceeded Admin"), | ||
("limit_exceeded_user", "Limit Exceeded User"), | ||
("read_only", "Read Only"), | ||
], | ||
), | ||
preserve_default=False, | ||
), | ||
migrations.RenameField( | ||
model_name="licenseusage", | ||
old_name="user_count", | ||
new_name="internal_user_count", | ||
), | ||
] |
Oops, something went wrong.