authentik.enterprise.lifecycle.apps
1from authentik.enterprise.apps import EnterpriseConfig 2from authentik.lib.utils.time import fqdn_rand 3from authentik.tasks.schedules.common import ScheduleSpec 4 5 6class LifecycleConfig(EnterpriseConfig): 7 name = "authentik.enterprise.lifecycle" 8 label = "authentik_lifecycle" 9 verbose_name = "authentik Enterprise.Lifecycle" 10 default = True 11 12 @property 13 def schedule_specs(self) -> list[ScheduleSpec]: 14 from authentik.enterprise.lifecycle.expiration.tasks import apply_expiration_rules 15 from authentik.enterprise.lifecycle.offboarding.tasks import execute_due_offboardings 16 from authentik.enterprise.lifecycle.review.tasks import apply_lifecycle_rules 17 18 return [ 19 ScheduleSpec( 20 actor=apply_lifecycle_rules, 21 crontab=f"{fqdn_rand('lifecycle_apply_lifecycle_rules')} " 22 f"{fqdn_rand('lifecycle_apply_lifecycle_rules', 24)} * * *", 23 ), 24 ScheduleSpec( 25 actor=apply_expiration_rules, 26 crontab=f"{fqdn_rand('lifecycle_apply_expiration_rules')} " 27 f"{fqdn_rand('lifecycle_apply_expiration_rules', 12)}-23/12 * * *", 28 ), 29 ScheduleSpec( 30 actor=execute_due_offboardings, 31 crontab=f"{fqdn_rand('lifecycle_execute_due_offboardings', 5)}-59/5 * * * *", 32 ), 33 ]
7class LifecycleConfig(EnterpriseConfig): 8 name = "authentik.enterprise.lifecycle" 9 label = "authentik_lifecycle" 10 verbose_name = "authentik Enterprise.Lifecycle" 11 default = True 12 13 @property 14 def schedule_specs(self) -> list[ScheduleSpec]: 15 from authentik.enterprise.lifecycle.expiration.tasks import apply_expiration_rules 16 from authentik.enterprise.lifecycle.offboarding.tasks import execute_due_offboardings 17 from authentik.enterprise.lifecycle.review.tasks import apply_lifecycle_rules 18 19 return [ 20 ScheduleSpec( 21 actor=apply_lifecycle_rules, 22 crontab=f"{fqdn_rand('lifecycle_apply_lifecycle_rules')} " 23 f"{fqdn_rand('lifecycle_apply_lifecycle_rules', 24)} * * *", 24 ), 25 ScheduleSpec( 26 actor=apply_expiration_rules, 27 crontab=f"{fqdn_rand('lifecycle_apply_expiration_rules')} " 28 f"{fqdn_rand('lifecycle_apply_expiration_rules', 12)}-23/12 * * *", 29 ), 30 ScheduleSpec( 31 actor=execute_due_offboardings, 32 crontab=f"{fqdn_rand('lifecycle_execute_due_offboardings', 5)}-59/5 * * * *", 33 ), 34 ]
Base app config for all enterprise apps
name =
'authentik.enterprise.lifecycle'
schedule_specs: list[authentik.tasks.schedules.common.ScheduleSpec]
13 @property 14 def schedule_specs(self) -> list[ScheduleSpec]: 15 from authentik.enterprise.lifecycle.expiration.tasks import apply_expiration_rules 16 from authentik.enterprise.lifecycle.offboarding.tasks import execute_due_offboardings 17 from authentik.enterprise.lifecycle.review.tasks import apply_lifecycle_rules 18 19 return [ 20 ScheduleSpec( 21 actor=apply_lifecycle_rules, 22 crontab=f"{fqdn_rand('lifecycle_apply_lifecycle_rules')} " 23 f"{fqdn_rand('lifecycle_apply_lifecycle_rules', 24)} * * *", 24 ), 25 ScheduleSpec( 26 actor=apply_expiration_rules, 27 crontab=f"{fqdn_rand('lifecycle_apply_expiration_rules')} " 28 f"{fqdn_rand('lifecycle_apply_expiration_rules', 12)}-23/12 * * *", 29 ), 30 ScheduleSpec( 31 actor=execute_due_offboardings, 32 crontab=f"{fqdn_rand('lifecycle_execute_due_offboardings', 5)}-59/5 * * * *", 33 ), 34 ]
Get a list of schedule specs that must exist