mirror of https://github.com/jumpserver/jumpserver
fix: 修改org_id位置
parent
0dba222796
commit
6b6f844795
|
@ -10,7 +10,7 @@ from common.utils import i18n_fmt, get_logger
|
||||||
from jumpserver.utils import current_request
|
from jumpserver.utils import current_request
|
||||||
from ops.celery import app
|
from ops.celery import app
|
||||||
from orgs.models import Organization
|
from orgs.models import Organization
|
||||||
from orgs.utils import current_org
|
from orgs.utils import current_org, tmp_to_org
|
||||||
from terminal.models import Session
|
from terminal.models import Session
|
||||||
from users.models import User
|
from users.models import User
|
||||||
from ..const import ActivityChoices
|
from ..const import ActivityChoices
|
||||||
|
@ -77,7 +77,8 @@ def create_activities(resource_ids, detail, detail_id, action, org_id):
|
||||||
)
|
)
|
||||||
for resource_id in resource_ids
|
for resource_id in resource_ids
|
||||||
]
|
]
|
||||||
ActivityLog.objects.bulk_create(activities)
|
with tmp_to_org(org_id):
|
||||||
|
ActivityLog.objects.bulk_create(activities)
|
||||||
return activities
|
return activities
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -47,8 +47,7 @@ class OrgManager(models.Manager):
|
||||||
if not obj.org_id:
|
if not obj.org_id:
|
||||||
raise ValidationError('Please save in a org')
|
raise ValidationError('Please save in a org')
|
||||||
else:
|
else:
|
||||||
if not getattr(obj, 'org_id', None):
|
obj.org_id = org.id
|
||||||
obj.org_id = org.id
|
|
||||||
return super().bulk_create(objs, batch_size, ignore_conflicts)
|
return super().bulk_create(objs, batch_size, ignore_conflicts)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue