|
3 | 3 | from copy import copy |
4 | 4 | from typing import TYPE_CHECKING, Any, Iterable, Literal, TypeVar, overload |
5 | 5 |
|
6 | | -from infrahub_sdk.utils import deep_merge_dict, is_valid_uuid |
| 6 | +from infrahub_sdk.utils import is_valid_uuid |
7 | 7 |
|
8 | 8 | from infrahub.core.constants import ( |
9 | 9 | SYSTEM_USER_ID, |
10 | | - InfrahubKind, |
11 | 10 | MetadataOptions, |
12 | 11 | RelationshipCardinality, |
13 | 12 | RelationshipDirection, |
@@ -188,23 +187,6 @@ async def query( |
188 | 187 | await query.execute(db=db) |
189 | 188 | node_ids = query.get_node_ids() |
190 | 189 |
|
191 | | - if ( |
192 | | - fields |
193 | | - and "identifier" in fields |
194 | | - and node_schema.kind |
195 | | - in [ |
196 | | - InfrahubKind.BASEPERMISSION, |
197 | | - InfrahubKind.GLOBALPERMISSION, |
198 | | - InfrahubKind.OBJECTPERMISSION, |
199 | | - ] |
200 | | - ): |
201 | | - # This is a workaround to ensure we are querying the right fields for permissions |
202 | | - # The identifier for permissions needs the same fields as the display label |
203 | | - schema_branch = db.schema.get_schema_branch(name=branch.name) |
204 | | - display_label_fields = schema_branch.generate_fields_for_display_label(name=node_schema.kind) |
205 | | - if display_label_fields: |
206 | | - deep_merge_dict(dicta=fields, dictb=display_label_fields) |
207 | | - |
208 | 190 | response = await cls.get_many( |
209 | 191 | ids=node_ids, |
210 | 192 | fields=fields, |
@@ -331,20 +313,6 @@ async def query_peers( |
331 | 313 | if not peers_info: |
332 | 314 | return [] |
333 | 315 |
|
334 | | - if fields and "identifier" in fields: |
335 | | - # This is a workaround to ensure we are querying the right fields for permissions |
336 | | - # The identifier for permissions needs the same fields as the display label |
337 | | - peer_schema = schema.get_peer_schema(db=db, branch=branch) |
338 | | - if peer_schema.kind in [ |
339 | | - InfrahubKind.BASEPERMISSION, |
340 | | - InfrahubKind.GLOBALPERMISSION, |
341 | | - InfrahubKind.OBJECTPERMISSION, |
342 | | - ]: |
343 | | - schema_branch = db.schema.get_schema_branch(name=branch.name) |
344 | | - display_label_fields = schema_branch.generate_fields_for_display_label(name=peer_schema.kind) |
345 | | - if display_label_fields: |
346 | | - deep_merge_dict(dicta=fields, dictb=display_label_fields) |
347 | | - |
348 | 316 | if fetch_peers: |
349 | 317 | peer_ids = [peer.peer_id for peer in peers_info] |
350 | 318 | peer_nodes = await cls.get_many( |
|
0 commit comments