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

Function get_share_objects

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

Source from the content-addressed store, hash-verified

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