From c986f5e76f5183524929d2b782ae0c37ee19d2aa Mon Sep 17 00:00:00 2001
From: songbing01249 <songbing@smyfinancial.com>
Date: Wed, 19 Jul 2023 14:42:27 +0800
Subject: [PATCH] fix(ci_type_group_manager): fix resources issues

---
 cmdb-api/api/lib/cmdb/ci_type.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cmdb-api/api/lib/cmdb/ci_type.py b/cmdb-api/api/lib/cmdb/ci_type.py
index 0c2d3bb..a88a16b 100644
--- a/cmdb-api/api/lib/cmdb/ci_type.py
+++ b/cmdb-api/api/lib/cmdb/ci_type.py
@@ -235,7 +235,7 @@ class CITypeGroupManager(object):
             for t in sorted(CITypeGroupItem.get_by(group_id=group['id']), key=lambda x: x['order'] or 0):
                 ci_type = CITypeCache.get(t['type_id']).to_dict()
                 if resources is None or (ci_type and ci_type['name'] in resources):
-                    ci_type['permissions'] = resources[ci_type['name']]
+                    ci_type['permissions'] = resources[ci_type['name']] if resources is not None else None
                     group.setdefault("ci_types", []).append(ci_type)
                     group_types.add(t["type_id"])
 
@@ -244,7 +244,7 @@ class CITypeGroupManager(object):
             other_types = dict(ci_types=[])
             for ci_type in ci_types:
                 if ci_type["id"] not in group_types and (resources is None or ci_type['name'] in resources):
-                    ci_type['permissions'] = resources.get(ci_type['name'])
+                    ci_type['permissions'] = resources.get(ci_type['name']) if resources is not None else None
                     other_types['ci_types'].append(ci_type)
 
             groups.append(other_types)