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

Function add_record_audit_data

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

Source from the content-addressed store, hash-verified

1112
1113
1114def add_record_audit_data(params, record_uids): # type: (KeeperParams, Iterable[str]) -> None
1115 if not params.enterprise_ec_key:
1116 return
1117
1118 uids = set((x for x in record_uids if x in params.record_cache))
1119 audit_data = [] # type: List[record_pb2.RecordAddAuditData]
1120 for record_uid in uids:
1121 record = get_record(params, record_uid)
1122 if record:
1123 if record.title:
1124 title = record.title
1125 if len(title) > 900:
1126 title = title[:900]
1127 audit = record_pb2.RecordAddAuditData()
1128 audit.record_uid = utils.base64_url_decode(record_uid)
1129 audit.revision = record.revision
1130 data = {
1131 'title': title,
1132 'record_type': record.record_type,
1133 }
1134 if record.login_url:
1135 data['url'] = utils.url_strip(record.login_url)
1136 audit.data = crypto.encrypt_ec(json.dumps(data).encode('utf-8'), params.enterprise_ec_key)
1137 audit_data.append(audit)
1138
1139 if audit_data:
1140 rq = record_pb2.AddAuditDataRequest()
1141 rq.records.extend(audit_data)
1142 try:
1143 communicate_rest(params, rq, 'vault/record_add_audit_data')
1144 except Exception as e:
1145 logging.info('Failed to store audit data: %s', str(e))
1146
1147
1148def 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