From 8090951b6c01a2916710cbb2e63b04a305a1af49 Mon Sep 17 00:00:00 2001 From: lian Date: Sat, 18 Jan 2025 12:01:49 +0800 Subject: [PATCH] use user limit to get org traffic limit --- seahub/organizations/api/admin/info.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/seahub/organizations/api/admin/info.py b/seahub/organizations/api/admin/info.py index 39bac448a58..cf488d4f405 100644 --- a/seahub/organizations/api/admin/info.py +++ b/seahub/organizations/api/admin/info.py @@ -18,14 +18,13 @@ from seahub.api2.authentication import TokenAuthentication from seahub.utils import get_org_traffic_by_month -from seahub.utils.ccnet_db import CcnetDB from seahub.utils.file_size import get_file_size_unit, get_quota_from_string from seahub.role_permissions.utils import get_enabled_role_permissions_by_role from seahub.organizations.api.permissions import IsOrgAdmin from seahub.organizations.models import OrgAdminSettings, \ OrgMemberQuota, FORCE_ADFS_LOGIN, DISABLE_ORG_ENCRYPTED_LIBRARY, \ - DISABLE_ORG_USER_CLEAN_TRASH + DISABLE_ORG_USER_CLEAN_TRASH, OrgSettings from seahub.organizations.settings import ORG_MEMBER_QUOTA_ENABLED, \ ORG_ENABLE_ADMIN_CUSTOM_NAME @@ -94,12 +93,11 @@ def get_org_info(request, org_id): info['traffic_this_month'] = get_org_traffic_by_month(org_id, current_date) info['traffic_limit'] = '' - role_perm_dict = get_enabled_role_permissions_by_role() + org_role = OrgSettings.objects.get_role_by_org(request.user.org) + role_perm_dict = get_enabled_role_permissions_by_role(org_role) monthly_rate_limit_per_user = role_perm_dict.get('monthly_rate_limit_per_user', '') if monthly_rate_limit_per_user: - ccnet_db = CcnetDB() - user_count = ccnet_db.get_org_user_count(org_id) - traffic_limit = get_quota_from_string(monthly_rate_limit_per_user) * user_count + traffic_limit = get_quota_from_string(monthly_rate_limit_per_user) * member_quota info['traffic_limit'] = traffic_limit info['storage_quota'] = storage_quota