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

Function get_share_objects

keepercommander/api.py:304–331  ·  view source on GitHub ↗
(params)

Source from the content-addressed store, hash-verified

302 return sf
303
304def get_share_objects(params): # type: (KeeperParams) -> Dict[str, Dict[str, Any]]
305 if not params.share_object_cache:
306 rq = GetShareObjectsRequest()
307 rs = communicate_rest(params, rq, 'vault/get_share_objects', rs_type=GetShareObjectsResponse)
308 users_by_type = dict(
309 relationship=rs.shareRelationships,
310 family= rs.shareFamilyUsers,
311 enterprise=rs.shareEnterpriseUsers,
312 mc=rs.shareMCEnterpriseUsers,
313 )
314 get_users = lambda rs_data, cat: {su.username: dict(name=su.fullname, is_sa=su.isShareAdmin, enterprise_id=su.enterpriseId, status=su.status, category=cat) for su in rs_data}
315 users = reduce(
316 lambda a, b: {**a, **b},
317 [get_users(users, cat) for cat, users in users_by_type.items()],
318 {}
319 )
320 enterprises = {se.enterpriseId: se.enterprisename for se in rs.shareEnterpriseNames}
321 get_teams = lambda rs_data: {utils.base64_url_encode(st.teamUid): dict(name=st.teamname, enterprise_id=st.enterpriseId) for st in rs_data}
322 teams = get_teams(rs.shareTeams)
323 teams_mc = get_teams(rs.shareMCTeams)
324
325 share_objects = dict(
326 users=users,
327 enterprises=enterprises,
328 teams={**teams, **teams_mc}
329 )
330 params.share_object_cache = share_objects
331 return params.share_object_cache
332
333def load_user_public_keys(params, emails, send_invites=False): # type: (KeeperParams, List[str], bool) -> Optional[List[str]]
334 s = set((x.casefold() for x in emails))

Callers

nothing calls this directly

Calls 1

communicate_restFunction · 0.85

Tested by

no test coverage detected