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

Method execute

keepercommander/commands/scim.py:200–239  ·  view source on GitHub ↗
(self, params, target=None, **kwargs)

Source from the content-addressed store, hash-verified

198 return scim_view_parser
199
200 def execute(self, params, target=None, **kwargs):
201 scim = find_scim(params, target)
202 fmt = kwargs.get('format')
203 node_id = scim['node_id']
204 node_name = self.get_node_path(params, node_id)
205 last_synced = scim.get('last_synced')
206 if isinstance(last_synced, int):
207 last_synced = datetime.datetime.fromtimestamp(last_synced / 1000)
208 else:
209 last_synced = None
210
211 if fmt == 'json':
212 j_output = {
213 'scim_id': scim['scim_id'],
214 'scim_url': get_scim_url(params, node_id),
215 'node_id': node_id,
216 'node_name': node_name,
217 'status': scim['status'],
218 'prefix': scim.get('role_prefix') or '',
219 'unique_groups': scim.get('unique_groups', False)
220 }
221 if last_synced:
222 j_output['last_synced'] = last_synced.strftime('%c')
223 output_file = kwargs.get('output')
224 if output_file:
225 with open(output_file, 'w') as f:
226 json.dump(j_output, f, indent=2)
227 logging.info('File name: %s', os.path.abspath(output_file))
228 else:
229 return json.dumps(j_output, indent=2)
230 else:
231 table = [
232 ['SCIM ID', scim['scim_id']], ['SCIM URL', get_scim_url(params, node_id)], ['Node ID', node_id],
233 ['Node Name', node_name],
234 ['Status', scim['status']], ['Prefix', scim.get('role_prefix') or ''],
235 ['Unique Groups', scim.get('unique_groups', False)]
236 ]
237 if last_synced:
238 table.append(['Last Synced', last_synced.strftime('%c')])
239 dump_report_data(table, ['key', 'value'], no_header=True, right_align=(0,))
240
241
242class ScimEditCommand(EnterpriseCommand):

Callers

nothing calls this directly

Calls 6

find_scimFunction · 0.85
get_scim_urlFunction · 0.85
dump_report_dataFunction · 0.85
get_node_pathMethod · 0.80
getMethod · 0.45
infoMethod · 0.45

Tested by

no test coverage detected