mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-09-27 15:54:14 +00:00
perf(orgs): 默认组织改为实体组织,并支持全局组织 (#5617)
* perf(orgs): 默认组织改为实体组织 * perf: 添加获取当前组织信息的api * perf: 资产列表在 root 组织下的表现 * fix: 修复 root 组织引起的问题 * perf: 优化OrgModelMixin save; org_root获取; org_roles获取; UserCanUseCurrentOrg权限类 Co-authored-by: ibuler <ibuler@qq.com> Co-authored-by: Bai <bugatti_it@163.com>
This commit is contained in:
@@ -13,18 +13,20 @@ logger = get_logger(__file__)
|
||||
|
||||
|
||||
@shared_task
|
||||
def check_node_assets_amount_task(orgid=None):
|
||||
if orgid is None:
|
||||
orgs = [*Organization.objects.all(), Organization.default()]
|
||||
def check_node_assets_amount_task(org_id=None):
|
||||
if org_id is None:
|
||||
orgs = Organization.objects.all()
|
||||
else:
|
||||
orgs = [Organization.get_instance(orgid)]
|
||||
orgs = [Organization.get_instance(org_id)]
|
||||
|
||||
for org in orgs:
|
||||
try:
|
||||
with tmp_to_org(org):
|
||||
check_node_assets_amount()
|
||||
except AcquireFailed:
|
||||
logger.error(_('The task of self-checking is already running and cannot be started repeatedly'))
|
||||
error = _('The task of self-checking is already running '
|
||||
'and cannot be started repeatedly')
|
||||
logger.error(error)
|
||||
|
||||
|
||||
@register_as_period_task(crontab='0 2 * * *')
|
||||
|
Reference in New Issue
Block a user