mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-16 18:05:52 +08:00
fix: get app id from upstream decorator
This commit is contained in:
parent
d1a25e54e5
commit
455d14296f
@ -55,10 +55,10 @@ def installed_app_required(view=None):
|
|||||||
def user_allowed_to_access_app(view=None):
|
def user_allowed_to_access_app(view=None):
|
||||||
def decorator(view):
|
def decorator(view):
|
||||||
@wraps(view)
|
@wraps(view)
|
||||||
def decorated(*args, **kwargs):
|
def decorated(installed_app: InstalledApp, *args, **kwargs):
|
||||||
feature = FeatureService.get_system_features()
|
feature = FeatureService.get_system_features()
|
||||||
if feature.webapp_auth.enabled:
|
if feature.webapp_auth.enabled:
|
||||||
app_id = kwargs.get("installed_app_id")
|
app_id = installed_app.app_id
|
||||||
app_code = AppService.get_app_code_by_id(app_id)
|
app_code = AppService.get_app_code_by_id(app_id)
|
||||||
logging.info(f"app_id: {app_id}, app_code: {app_code}")
|
logging.info(f"app_id: {app_id}, app_code: {app_code}")
|
||||||
res = EnterpriseService.WebAppAuth.is_user_allowed_to_access_webapp(
|
res = EnterpriseService.WebAppAuth.is_user_allowed_to_access_webapp(
|
||||||
@ -69,7 +69,7 @@ def user_allowed_to_access_app(view=None):
|
|||||||
if not res:
|
if not res:
|
||||||
raise Unauthorized("User not allowed to access this app")
|
raise Unauthorized("User not allowed to access this app")
|
||||||
|
|
||||||
return view(*args, **kwargs)
|
return view(installed_app, *args, **kwargs)
|
||||||
|
|
||||||
return decorated
|
return decorated
|
||||||
if view:
|
if view:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user