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

Function enumerate_record_access_paths

keepercommander/api.py:1424–1470  ·  view source on GitHub ↗
(params, record_uid)

Source from the content-addressed store, hash-verified

1422
1423
1424def enumerate_record_access_paths(params, record_uid):
1425 # type: (KeeperParams, str) -> collections.Iterable[dict]
1426
1427 if record_uid in params.meta_data_cache:
1428 rmd = params.meta_data_cache[record_uid]
1429 yield {
1430 'record_uid': record_uid,
1431 'can_edit': rmd.get('can_edit') or False,
1432 'can_share': rmd.get('can_share') or False,
1433 'can_view': True
1434 }
1435
1436 for sf_uid in params.shared_folder_cache:
1437 sf = params.shared_folder_cache[sf_uid]
1438 if 'records' in sf:
1439 sfrs = [x for x in sf['records'] if x['record_uid'] == record_uid]
1440 if len(sfrs) > 0:
1441 sfr = sfrs[0]
1442 is_owner = sfr.get('owner') is True
1443 if is_owner:
1444 can_edit = True
1445 can_share = True
1446 else:
1447 can_edit = sfr['can_edit']
1448 can_share = sfr['can_share']
1449 if 'key_type' in sf:
1450 yield {
1451 'record_uid': record_uid,
1452 'shared_folder_uid': sf_uid,
1453 'can_edit': can_edit,
1454 'can_share': can_share,
1455 'can_view': True
1456 }
1457 else:
1458 if 'teams' in sf:
1459 for sf_team in sf['teams']:
1460 team_uid = sf_team['team_uid']
1461 if team_uid in params.team_cache:
1462 team = params.team_cache[team_uid]
1463 yield {
1464 'record_uid': record_uid,
1465 'shared_folder_uid': sf_uid,
1466 'team_uid': team_uid,
1467 'can_edit': can_edit and not team['restrict_edit'],
1468 'can_share': can_share and not team['restrict_share'],
1469 'can_view': not team['restrict_view']
1470 }
1471
1472
1473def get_record_shares(params, record_uids, is_share_admin=False):

Callers 2

Calls 1

getMethod · 0.45

Tested by

no test coverage detected