(params, record_uid, path=None)
| 1326 | |
| 1327 | |
| 1328 | def resolve_record_access_path(params, record_uid, path=None): |
| 1329 | # type: (KeeperParams, str, dict or None) -> dict |
| 1330 | best_path = None |
| 1331 | |
| 1332 | for ap in enumerate_record_access_paths(params, record_uid): |
| 1333 | use_this_path = False |
| 1334 | if not best_path: |
| 1335 | use_this_path = True |
| 1336 | else: |
| 1337 | if not best_path.get('can_edit') and ap.get('can_edit'): |
| 1338 | use_this_path = True |
| 1339 | elif not best_path.get('can_share') and ap.get('can_share'): |
| 1340 | use_this_path = True |
| 1341 | elif not best_path.get('can_view') and ap.get('can_view'): |
| 1342 | use_this_path = True |
| 1343 | |
| 1344 | if use_this_path: |
| 1345 | best_path = ap |
| 1346 | if best_path.get('can_edit') and best_path.get('can_share') and best_path.get('can_view'): |
| 1347 | break |
| 1348 | |
| 1349 | if path is None: |
| 1350 | path = { |
| 1351 | 'record_uid': record_uid |
| 1352 | } |
| 1353 | |
| 1354 | if best_path: |
| 1355 | if 'shared_folder_uid' in best_path: |
| 1356 | path['shared_folder_uid'] = best_path['shared_folder_uid'] |
| 1357 | if 'team_uid' in best_path: |
| 1358 | path['team_uid'] = best_path['team_uid'] |
| 1359 | |
| 1360 | return path |
| 1361 | |
| 1362 | |
| 1363 | def enumerate_record_access_paths(params, record_uid): |
nothing calls this directly
no test coverage detected