(params, record_uid, path=None)
| 1351 | |
| 1352 | |
| 1353 | def resolve_record_access_path(params, record_uid, path=None): |
| 1354 | # type: (KeeperParams, str, dict or None) -> dict |
| 1355 | best_path = None |
| 1356 | |
| 1357 | for ap in enumerate_record_access_paths(params, record_uid): |
| 1358 | use_this_path = False |
| 1359 | if not best_path: |
| 1360 | use_this_path = True |
| 1361 | else: |
| 1362 | if not best_path.get('can_edit') and ap.get('can_edit'): |
| 1363 | use_this_path = True |
| 1364 | elif not best_path.get('can_share') and ap.get('can_share'): |
| 1365 | use_this_path = True |
| 1366 | elif not best_path.get('can_view') and ap.get('can_view'): |
| 1367 | use_this_path = True |
| 1368 | |
| 1369 | if use_this_path: |
| 1370 | best_path = ap |
| 1371 | if best_path.get('can_edit') and best_path.get('can_share') and best_path.get('can_view'): |
| 1372 | break |
| 1373 | |
| 1374 | if path is None: |
| 1375 | path = { |
| 1376 | 'record_uid': record_uid |
| 1377 | } |
| 1378 | |
| 1379 | if best_path: |
| 1380 | if 'shared_folder_uid' in best_path: |
| 1381 | path['shared_folder_uid'] = best_path['shared_folder_uid'] |
| 1382 | if 'team_uid' in best_path: |
| 1383 | path['team_uid'] = best_path['team_uid'] |
| 1384 | |
| 1385 | return path |
| 1386 | |
| 1387 | |
| 1388 | def enumerate_record_access_paths(params, record_uid): |
nothing calls this directly
no test coverage detected