mirror of
https://github.com/langgenius/dify.git
synced 2026-03-14 13:51:33 +08:00
fix(app-copy): inherit web app permission from original app
When copying an app, the copied app was not getting a web_app_settings record created. This caused the enterprise service to query for settings that don't exist, falling back to default behavior. This fix ensures copied apps inherit the same access mode as the original: - If original has explicit settings (public/private/private_all/sso_verified), the copy gets the same setting - If original has no settings (old apps), copy defaults to 'public' to match the original's effective permission via fallback This prevents permission mismatches between original and copied apps and ensures the enterprise service has explicit settings to query. Related: langgenius/dify-enterprise#423
This commit is contained in:
parent
affd07ae94
commit
efbdb4c706
@ -660,6 +660,19 @@ class AppCopyApi(Resource):
|
||||
)
|
||||
session.commit()
|
||||
|
||||
# Inherit web app permission from original app
|
||||
if result.app_id and FeatureService.get_system_features().webapp_auth.enabled:
|
||||
try:
|
||||
# Get the original app's access mode
|
||||
original_settings = EnterpriseService.WebAppAuth.get_app_access_mode_by_id(app_model.id)
|
||||
access_mode = original_settings.access_mode
|
||||
except Exception:
|
||||
# If original app has no settings (old app), default to public to match fallback behavior
|
||||
access_mode = "public"
|
||||
|
||||
# Apply the same access mode to the copied app
|
||||
EnterpriseService.WebAppAuth.update_app_access_mode(result.app_id, access_mode)
|
||||
|
||||
stmt = select(App).where(App.id == result.app_id)
|
||||
app = session.scalar(stmt)
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user