forked from goauthentik/authentik
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
blueprints: webui (goauthentik#3356)
- Loading branch information
Showing
78 changed files
with
921 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +0,0 @@ | ||
"""Blueprint helpers""" | ||
from functools import wraps | ||
from typing import Callable | ||
|
||
|
||
def apply_blueprint(*files: str): | ||
"""Apply blueprint before test""" | ||
|
||
from authentik.blueprints.v1.importer import Importer | ||
|
||
def wrapper_outer(func: Callable): | ||
"""Apply blueprint before test""" | ||
|
||
@wraps(func) | ||
def wrapper(*args, **kwargs): | ||
for file in files: | ||
with open(file, "r+", encoding="utf-8") as _file: | ||
Importer(_file.read()).apply() | ||
return func(*args, **kwargs) | ||
|
||
return wrapper | ||
|
||
return wrapper_outer | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
"""Blueprint helpers""" | ||
from functools import wraps | ||
from typing import Callable | ||
|
||
from django.apps import apps | ||
|
||
from authentik.blueprints.manager import ManagedAppConfig | ||
|
||
|
||
def apply_blueprint(*files: str): | ||
"""Apply blueprint before test""" | ||
|
||
from authentik.blueprints.v1.importer import Importer | ||
|
||
def wrapper_outer(func: Callable): | ||
"""Apply blueprint before test""" | ||
|
||
@wraps(func) | ||
def wrapper(*args, **kwargs): | ||
for file in files: | ||
with open(file, "r+", encoding="utf-8") as _file: | ||
Importer(_file.read()).apply() | ||
return func(*args, **kwargs) | ||
|
||
return wrapper | ||
|
||
return wrapper_outer | ||
|
||
|
||
def reconcile_app(app_name: str): | ||
"""Re-reconcile AppConfig methods""" | ||
|
||
def wrapper_outer(func: Callable): | ||
"""Re-reconcile AppConfig methods""" | ||
|
||
@wraps(func) | ||
def wrapper(*args, **kwargs): | ||
config = apps.get_app_config(app_name) | ||
if isinstance(config, ManagedAppConfig): | ||
config.reconcile() | ||
return func(*args, **kwargs) | ||
|
||
return wrapper | ||
|
||
return wrapper_outer |
Oops, something went wrong.