Merge pull request #11346 from jumpserver/pr@dev@fix_sessionshare

fix: 修复创建会话分享不填写用户报错的问题
pull/11349/head
老广 2023-08-18 16:52:07 +08:00 committed by GitHub
commit f3af9c3108
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -6,6 +6,7 @@ from django.utils.translation import gettext_lazy as _
from django.utils.functional import cached_property from django.utils.functional import cached_property
from common.db.models import JMSBaseModel from common.db.models import JMSBaseModel
from common.utils import is_uuid
from orgs.mixins.models import OrgModelMixin from orgs.mixins.models import OrgModelMixin
from orgs.utils import tmp_to_root_org from orgs.utils import tmp_to_root_org
from users.models import User from users.models import User
@ -62,6 +63,9 @@ class SessionSharing(JMSBaseModel, OrgModelMixin):
@cached_property @cached_property
def users_queryset(self): def users_queryset(self):
user_ids = self.users.split(',') user_ids = self.users.split(',')
user_ids = [user_id for user_id in user_ids if is_uuid(user_id)]
if not user_ids:
return User.objects.none()
return User.objects.filter(id__in=user_ids) return User.objects.filter(id__in=user_ids)
@property @property