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

Function add_record_audit_data

keepercommander/api.py:1175–1206  ·  view source on GitHub ↗
(params, record_uids)

Source from the content-addressed store, hash-verified

1173
1174
1175def add_record_audit_data(params, record_uids): # type: (KeeperParams, Iterable[str]) -> None
1176 if not params.enterprise_ec_key:
1177 return
1178
1179 uids = set((x for x in record_uids if x in params.record_cache))
1180 audit_data = [] # type: List[record_pb2.RecordAddAuditData]
1181 for record_uid in uids:
1182 record = get_record(params, record_uid)
1183 if record:
1184 if record.title:
1185 title = record.title
1186 if len(title) > 900:
1187 title = title[:900]
1188 audit = record_pb2.RecordAddAuditData()
1189 audit.record_uid = utils.base64_url_decode(record_uid)
1190 audit.revision = record.revision
1191 data = {
1192 'title': title,
1193 'record_type': record.record_type,
1194 }
1195 if record.login_url:
1196 data['url'] = utils.url_strip(record.login_url)
1197 audit.data = crypto.encrypt_ec(json.dumps(data).encode('utf-8'), params.enterprise_ec_key)
1198 audit_data.append(audit)
1199
1200 if audit_data:
1201 rq = record_pb2.AddAuditDataRequest()
1202 rq.records.extend(audit_data)
1203 try:
1204 communicate_rest(params, rq, 'vault/record_add_audit_data')
1205 except Exception as e:
1206 logging.info('Failed to store audit data: %s', str(e))
1207
1208
1209def add_record_v3(params, record, **kwargs): # type: (KeeperParams, dict, ...) -> Optional[bool]

Callers 1

update_recordFunction · 0.70

Calls 3

communicate_restFunction · 0.85
get_recordFunction · 0.70
infoMethod · 0.45

Tested by

no test coverage detected