mirror of https://github.com/veops/cmdb.git
Dev api password (#244)
* fix: delete CI password data * fix(api): update CI password to flush cache
This commit is contained in:
parent
89e492c1f3
commit
2db41dd992
|
@ -723,7 +723,6 @@ class CIManager(object):
|
||||||
def save_password(cls, ci_id, attr_id, value, record_id, type_id):
|
def save_password(cls, ci_id, attr_id, value, record_id, type_id):
|
||||||
changed = None
|
changed = None
|
||||||
encrypt_value = None
|
encrypt_value = None
|
||||||
|
|
||||||
value_table = ValueTypeMap.table[ValueTypeEnum.PASSWORD]
|
value_table = ValueTypeMap.table[ValueTypeEnum.PASSWORD]
|
||||||
if current_app.config.get('SECRETS_ENGINE') == 'inner':
|
if current_app.config.get('SECRETS_ENGINE') == 'inner':
|
||||||
if value:
|
if value:
|
||||||
|
@ -762,7 +761,7 @@ class CIManager(object):
|
||||||
current_app.logger.warning('delete password to vault failed: {}'.format(e))
|
current_app.logger.warning('delete password to vault failed: {}'.format(e))
|
||||||
|
|
||||||
if changed is not None:
|
if changed is not None:
|
||||||
AttributeValueManager.write_change2(changed, record_id)
|
return AttributeValueManager.write_change2(changed, record_id)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def load_password(cls, ci_id, attr_id):
|
def load_password(cls, ci_id, attr_id):
|
||||||
|
|
|
@ -69,7 +69,7 @@ class AttributeValueManager(object):
|
||||||
if attr.is_list:
|
if attr.is_list:
|
||||||
res[field_name] = [ValueTypeMap.serialize[attr.value_type](i.value) for i in rs]
|
res[field_name] = [ValueTypeMap.serialize[attr.value_type](i.value) for i in rs]
|
||||||
elif attr.is_password and rs:
|
elif attr.is_password and rs:
|
||||||
res[field_name] = '******'
|
res[field_name] = '******' if rs[0].value else ''
|
||||||
else:
|
else:
|
||||||
res[field_name] = ValueTypeMap.serialize[attr.value_type](rs[0].value) if rs else None
|
res[field_name] = ValueTypeMap.serialize[attr.value_type](rs[0].value) if rs else None
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue