diff --git a/apps/rbac/models/rolebinding.py b/apps/rbac/models/rolebinding.py index c0ac806ef..835fbf6a7 100644 --- a/apps/rbac/models/rolebinding.py +++ b/apps/rbac/models/rolebinding.py @@ -1,6 +1,7 @@ from django.utils.translation import gettext_lazy as _ from django.db import models from django.db.models import Q +from django.conf import settings from django.core.exceptions import ValidationError from rest_framework.serializers import ValidationError @@ -115,6 +116,9 @@ class RoleBinding(JMSModel): else: all_orgs = Organization.objects.all() + if not settings.XPACK_ENABLED: + all_orgs = all_orgs.filter(id=Organization.DEFAULT_ID) + # 有系统级别的绑定,就代表在所有组织有这个权限 if system_bindings: orgs = all_orgs