mirror of
https://github.com/langgenius/dify.git
synced 2026-03-06 07:35:14 +00:00
Compare commits
4 Commits
deploy/mem
...
release/e-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d760862e8d | ||
|
|
8899c717fa | ||
|
|
ef2c8cd3f3 | ||
|
|
f6272dbb88 |
2
.github/workflows/build-push.yml
vendored
2
.github/workflows/build-push.yml
vendored
@@ -6,6 +6,8 @@ on:
|
|||||||
- "main"
|
- "main"
|
||||||
- "deploy/dev"
|
- "deploy/dev"
|
||||||
- "deploy/enterprise"
|
- "deploy/enterprise"
|
||||||
|
- "build/**"
|
||||||
|
- "release/e-*"
|
||||||
tags:
|
tags:
|
||||||
- "*"
|
- "*"
|
||||||
|
|
||||||
|
|||||||
@@ -58,21 +58,38 @@ class InstalledAppsListApi(Resource):
|
|||||||
# filter out apps that user doesn't have access to
|
# filter out apps that user doesn't have access to
|
||||||
if FeatureService.get_system_features().webapp_auth.enabled:
|
if FeatureService.get_system_features().webapp_auth.enabled:
|
||||||
user_id = current_user.id
|
user_id = current_user.id
|
||||||
res = []
|
|
||||||
app_ids = [installed_app["app"].id for installed_app in installed_app_list]
|
app_ids = [installed_app["app"].id for installed_app in installed_app_list]
|
||||||
webapp_settings = EnterpriseService.WebAppAuth.batch_get_app_access_mode_by_id(app_ids)
|
webapp_settings = EnterpriseService.WebAppAuth.batch_get_app_access_mode_by_id(app_ids)
|
||||||
|
|
||||||
|
# Pre-filter out apps without setting or with sso_verified
|
||||||
|
filtered_installed_apps = []
|
||||||
|
app_id_to_app_code = {}
|
||||||
|
|
||||||
for installed_app in installed_app_list:
|
for installed_app in installed_app_list:
|
||||||
webapp_setting = webapp_settings.get(installed_app["app"].id)
|
app_id = installed_app["app"].id
|
||||||
if not webapp_setting:
|
webapp_setting = webapp_settings.get(app_id)
|
||||||
|
if not webapp_setting or webapp_setting.access_mode == "sso_verified":
|
||||||
continue
|
continue
|
||||||
if webapp_setting.access_mode == "sso_verified":
|
app_code = AppService.get_app_code_by_id(str(app_id))
|
||||||
continue
|
app_id_to_app_code[app_id] = app_code
|
||||||
app_code = AppService.get_app_code_by_id(str(installed_app["app"].id))
|
filtered_installed_apps.append(installed_app)
|
||||||
if EnterpriseService.WebAppAuth.is_user_allowed_to_access_webapp(
|
|
||||||
user_id=user_id,
|
app_codes = list(app_id_to_app_code.values())
|
||||||
app_code=app_code,
|
|
||||||
):
|
# Batch permission check
|
||||||
|
permissions = EnterpriseService.WebAppAuth.batch_is_user_allowed_to_access_webapps(
|
||||||
|
user_id=user_id,
|
||||||
|
app_codes=app_codes,
|
||||||
|
)
|
||||||
|
|
||||||
|
# Keep only allowed apps
|
||||||
|
res = []
|
||||||
|
for installed_app in filtered_installed_apps:
|
||||||
|
app_id = installed_app["app"].id
|
||||||
|
app_code = app_id_to_app_code[app_id]
|
||||||
|
if permissions.get(app_code):
|
||||||
res.append(installed_app)
|
res.append(installed_app)
|
||||||
|
|
||||||
installed_app_list = res
|
installed_app_list = res
|
||||||
logger.debug(f"installed_app_list: {installed_app_list}, user_id: {user_id}")
|
logger.debug(f"installed_app_list: {installed_app_list}, user_id: {user_id}")
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,16 @@ class EnterpriseService:
|
|||||||
|
|
||||||
return data.get("result", False)
|
return data.get("result", False)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def batch_is_user_allowed_to_access_webapps(cls, user_id: str, app_codes: list[str]):
|
||||||
|
if not app_codes:
|
||||||
|
return {}
|
||||||
|
body = {"userId": user_id, "appCodes": app_codes}
|
||||||
|
data = EnterpriseRequest.send_request("POST", "/webapp/permission/batch", json=body)
|
||||||
|
if not data:
|
||||||
|
raise ValueError("No data found.")
|
||||||
|
return data.get("permissions", {})
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_app_access_mode_by_id(cls, app_id: str) -> WebAppSettings:
|
def get_app_access_mode_by_id(cls, app_id: str) -> WebAppSettings:
|
||||||
if not app_id:
|
if not app_id:
|
||||||
|
|||||||
@@ -103,14 +103,14 @@
|
|||||||
"mime": "^4.0.4",
|
"mime": "^4.0.4",
|
||||||
"mitt": "^3.0.1",
|
"mitt": "^3.0.1",
|
||||||
"negotiator": "^0.6.3",
|
"negotiator": "^0.6.3",
|
||||||
"next": "15.2.4",
|
"next": "15.5.7",
|
||||||
"next-themes": "^0.4.3",
|
"next-themes": "^0.4.3",
|
||||||
"pinyin-pro": "^3.25.0",
|
"pinyin-pro": "^3.25.0",
|
||||||
"qrcode.react": "^4.2.0",
|
"qrcode.react": "^4.2.0",
|
||||||
"qs": "^6.13.0",
|
"qs": "^6.13.0",
|
||||||
"react": "19.0.0",
|
"react": "19.2.1",
|
||||||
"react-18-input-autosize": "^3.0.0",
|
"react-18-input-autosize": "^3.0.0",
|
||||||
"react-dom": "19.0.0",
|
"react-dom": "19.2.1",
|
||||||
"react-easy-crop": "^5.1.0",
|
"react-easy-crop": "^5.1.0",
|
||||||
"react-error-boundary": "^4.1.2",
|
"react-error-boundary": "^4.1.2",
|
||||||
"react-headless-pagination": "^1.1.6",
|
"react-headless-pagination": "^1.1.6",
|
||||||
@@ -159,7 +159,7 @@
|
|||||||
"@eslint/js": "^9.20.0",
|
"@eslint/js": "^9.20.0",
|
||||||
"@faker-js/faker": "^9.0.3",
|
"@faker-js/faker": "^9.0.3",
|
||||||
"@happy-dom/jest-environment": "^17.4.4",
|
"@happy-dom/jest-environment": "^17.4.4",
|
||||||
"@next/eslint-plugin-next": "^15.2.3",
|
"@next/eslint-plugin-next": "^15.5.7",
|
||||||
"@rgrove/parse-xml": "^4.1.0",
|
"@rgrove/parse-xml": "^4.1.0",
|
||||||
"@storybook/addon-essentials": "8.5.0",
|
"@storybook/addon-essentials": "8.5.0",
|
||||||
"@storybook/addon-interactions": "8.5.0",
|
"@storybook/addon-interactions": "8.5.0",
|
||||||
@@ -181,8 +181,8 @@
|
|||||||
"@types/negotiator": "^0.6.3",
|
"@types/negotiator": "^0.6.3",
|
||||||
"@types/node": "18.15.0",
|
"@types/node": "18.15.0",
|
||||||
"@types/qs": "^6.9.16",
|
"@types/qs": "^6.9.16",
|
||||||
"@types/react": "19.0.11",
|
"@types/react": "~19.2.7",
|
||||||
"@types/react-dom": "19.0.4",
|
"@types/react-dom": "~19.2.3",
|
||||||
"@types/react-slider": "^1.3.6",
|
"@types/react-slider": "^1.3.6",
|
||||||
"@types/react-syntax-highlighter": "^15.5.13",
|
"@types/react-syntax-highlighter": "^15.5.13",
|
||||||
"@types/react-window": "^1.8.8",
|
"@types/react-window": "^1.8.8",
|
||||||
@@ -196,7 +196,7 @@
|
|||||||
"code-inspector-plugin": "^0.18.1",
|
"code-inspector-plugin": "^0.18.1",
|
||||||
"cross-env": "^7.0.3",
|
"cross-env": "^7.0.3",
|
||||||
"eslint": "^9.20.1",
|
"eslint": "^9.20.1",
|
||||||
"eslint-config-next": "^15.0.0",
|
"eslint-config-next": "^15.5.7",
|
||||||
"eslint-plugin-react-hooks": "^5.1.0",
|
"eslint-plugin-react-hooks": "^5.1.0",
|
||||||
"eslint-plugin-react-refresh": "^0.4.19",
|
"eslint-plugin-react-refresh": "^0.4.19",
|
||||||
"eslint-plugin-sonarjs": "^3.0.2",
|
"eslint-plugin-sonarjs": "^3.0.2",
|
||||||
@@ -217,8 +217,8 @@
|
|||||||
"uglify-js": "^3.19.3"
|
"uglify-js": "^3.19.3"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"@types/react": "~18.2.0",
|
"@types/react": "~19.2.7",
|
||||||
"@types/react-dom": "~18.2.0",
|
"@types/react-dom": "~19.2.3",
|
||||||
"string-width": "4.2.3"
|
"string-width": "4.2.3"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
@@ -230,8 +230,8 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"overrides": {
|
"overrides": {
|
||||||
"@types/react": "19.0.11",
|
"@types/react": "19.2.7",
|
||||||
"@types/react-dom": "19.0.4",
|
"@types/react-dom": "19.2.3",
|
||||||
"@storybook/test": "8.5.0"
|
"@storybook/test": "8.5.0"
|
||||||
},
|
},
|
||||||
"pnpm": {
|
"pnpm": {
|
||||||
|
|||||||
2318
web/pnpm-lock.yaml
generated
2318
web/pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user