mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-06-27 07:17:10 +00:00
fix: When the organization does not exist, close ticket with an error.
This commit is contained in:
parent
f64eab7a15
commit
404d58a9c9
@ -5,8 +5,8 @@ from contextlib import contextmanager
|
|||||||
from functools import wraps
|
from functools import wraps
|
||||||
from inspect import signature
|
from inspect import signature
|
||||||
|
|
||||||
from werkzeug.local import LocalProxy
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
from werkzeug.local import LocalProxy
|
||||||
|
|
||||||
from common.local import thread_local
|
from common.local import thread_local
|
||||||
from .models import Organization
|
from .models import Organization
|
||||||
@ -57,6 +57,8 @@ def get_org_from_request(request):
|
|||||||
def set_current_org(org):
|
def set_current_org(org):
|
||||||
if isinstance(org, (str, uuid.UUID)):
|
if isinstance(org, (str, uuid.UUID)):
|
||||||
org = Organization.get_instance(org)
|
org = Organization.get_instance(org)
|
||||||
|
if not org:
|
||||||
|
return
|
||||||
setattr(thread_local, 'current_org_id', org.id)
|
setattr(thread_local, 'current_org_id', org.id)
|
||||||
|
|
||||||
|
|
||||||
|
@ -424,7 +424,8 @@ class Ticket(StatusMixin, JMSBaseModel):
|
|||||||
new_values.append(str(new_value))
|
new_values.append(str(new_value))
|
||||||
value = ', '.join(new_values)
|
value = ', '.join(new_values)
|
||||||
elif name == 'org_id':
|
elif name == 'org_id':
|
||||||
value = Organization.get_instance(value).name
|
org = Organization.get_instance(value)
|
||||||
|
value = org.name if org else ''
|
||||||
elif isinstance(value, list):
|
elif isinstance(value, list):
|
||||||
value = ', '.join(value)
|
value = ', '.join(value)
|
||||||
return value
|
return value
|
||||||
|
Loading…
Reference in New Issue
Block a user