[PR #22292] minor fix: fix dissolve tenant check permission always failed #29890

Closed
opened 2026-02-21 20:46:26 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/22292

State: closed
Merged: Yes


Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

This PR fixes a critical bug in the dissolve_tenant method where permission checking was always failing due to incorrect parameter passing. The issue was in the TenantService.check_member_permission call where the operator was being passed twice instead of passing None for the target member parameter.

Changes Made:

  • Fixed the check_member_permission call in dissolve_tenant method
  • Removed the redundant error handling since check_member_permission already raises appropriate exceptions
  • Changed from if not TenantService.check_member_permission(tenant, operator, operator, "remove") to TenantService.check_member_permission(tenant, operator, None, "remove")

Root Cause:

The original code was passing operator as both the operator and target member parameters, which caused the permission check logic to fail incorrectly. For tenant dissolution, the target member should be None since we're checking if the operator has permission to dissolve the entire tenant.

Impact:

  • Fixes tenant dissolution functionality that was previously broken
  • Ensures proper permission validation for tenant dissolution operations
  • Maintains security by keeping permission checks in place

Screenshots

Before After
Permission check always failed, preventing legitimate tenant dissolution Permission check works correctly, allowing authorized users to dissolve tenants

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
**Original Pull Request:** https://github.com/langgenius/dify/pull/22292 **State:** closed **Merged:** Yes --- > [!IMPORTANT] > > 1. Make sure you have read our [contribution guidelines](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) > 2. Ensure there is an associated issue and you have been assigned to it > 3. Use the correct syntax to link this PR: `Fixes #<issue number>`. ## Summary This PR fixes a critical bug in the `dissolve_tenant` method where permission checking was always failing due to incorrect parameter passing. The issue was in the `TenantService.check_member_permission` call where the operator was being passed twice instead of passing `None` for the target member parameter. ### Changes Made: - Fixed the `check_member_permission` call in `dissolve_tenant` method - Removed the redundant error handling since `check_member_permission` already raises appropriate exceptions - Changed from `if not TenantService.check_member_permission(tenant, operator, operator, "remove")` to `TenantService.check_member_permission(tenant, operator, None, "remove")` ### Root Cause: The original code was passing `operator` as both the operator and target member parameters, which caused the permission check logic to fail incorrectly. For tenant dissolution, the target member should be `None` since we're checking if the operator has permission to dissolve the entire tenant. ### Impact: - Fixes tenant dissolution functionality that was previously broken - Ensures proper permission validation for tenant dissolution operations - Maintains security by keeping permission checks in place ## Screenshots | Before | After | |--------|-------| | Permission check always failed, preventing legitimate tenant dissolution | Permission check works correctly, allowing authorized users to dissolve tenants | ## Checklist - [ ] This change requires a documentation update, included: [Dify Document](https://github.com/langgenius/dify-docs) - [x] I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!) - [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change. - [x] I've updated the documentation accordingly. - [x] I ran `dev/reformat`(backend) and `cd web && npx lint-staged`(frontend) to appease the lint gods
yindo added the pull-request label 2026-02-21 20:46:26 -05:00
yindo closed this issue 2026-02-21 20:46:26 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#29890