From 34e09829fbb2fd330744e688f03bf80e95b94e84 Mon Sep 17 00:00:00 2001 From: Xiyuan Chen <52963600+GareArc@users.noreply.github.com> Date: Fri, 13 Feb 2026 22:34:45 -0800 Subject: [PATCH] fix(app-copy): inherit web app permission from original app (#32323) --- api/controllers/console/app/app.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/api/controllers/console/app/app.py b/api/controllers/console/app/app.py index 91034f2d87..42901ab590 100644 --- a/api/controllers/console/app/app.py +++ b/api/controllers/console/app/app.py @@ -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)