MCPcopy Create free account
hub / github.com/Keeper-Security/Commander / resolve_record_access_path

Function resolve_record_access_path

keepercommander/api.py:1398–1430  ·  view source on GitHub ↗
(params, record_uid, path=None)

Source from the content-addressed store, hash-verified

1396
1397
1398def resolve_record_access_path(params, record_uid, path=None):
1399 # type: (KeeperParams, str, dict or None) -> dict
1400 best_path = None
1401
1402 for ap in enumerate_record_access_paths(params, record_uid):
1403 use_this_path = False
1404 if not best_path:
1405 use_this_path = True
1406 else:
1407 if not best_path.get('can_edit') and ap.get('can_edit'):
1408 use_this_path = True
1409 elif not best_path.get('can_share') and ap.get('can_share'):
1410 use_this_path = True
1411 elif not best_path.get('can_view') and ap.get('can_view'):
1412 use_this_path = True
1413
1414 if use_this_path:
1415 best_path = ap
1416 if best_path.get('can_edit') and best_path.get('can_share') and best_path.get('can_view'):
1417 break
1418
1419 if path is None:
1420 path = {
1421 'record_uid': record_uid
1422 }
1423
1424 if best_path:
1425 if 'shared_folder_uid' in best_path:
1426 path['shared_folder_uid'] = best_path['shared_folder_uid']
1427 if 'team_uid' in best_path:
1428 path['team_uid'] = best_path['team_uid']
1429
1430 return path
1431
1432
1433def enumerate_record_access_paths(params, record_uid):

Callers

nothing calls this directly

Calls 2

getMethod · 0.45

Tested by

no test coverage detected