mirror of https://github.com/veops/cmdb.git
fix(api): auto discovery configuration save password
fix(api): auto discovery configuration save password
This commit is contained in:
parent
d5db68d7d0
commit
bc66d33ce0
|
@ -273,6 +273,12 @@ class AutoDiscoveryCITypeCRUD(DBMixin):
|
||||||
result.append(rule)
|
result.append(rule)
|
||||||
break
|
break
|
||||||
elif not rule['agent_id'] and not rule['query_expr'] and rule['adr_id']:
|
elif not rule['agent_id'] and not rule['query_expr'] and rule['adr_id']:
|
||||||
|
try:
|
||||||
|
if not int(oneagent_id, 16): # excludes master
|
||||||
|
continue
|
||||||
|
except Exception:
|
||||||
|
pass
|
||||||
|
|
||||||
adr = AutoDiscoveryRuleCRUD.get_by_id(rule['adr_id'])
|
adr = AutoDiscoveryRuleCRUD.get_by_id(rule['adr_id'])
|
||||||
if not adr:
|
if not adr:
|
||||||
continue
|
continue
|
||||||
|
|
|
@ -149,6 +149,11 @@ class AutoDiscoveryCITypeView(APIView):
|
||||||
i['extra_option'].pop('secret', None)
|
i['extra_option'].pop('secret', None)
|
||||||
else:
|
else:
|
||||||
i['extra_option']['secret'] = AESCrypto.decrypt(i['extra_option']['secret'])
|
i['extra_option']['secret'] = AESCrypto.decrypt(i['extra_option']['secret'])
|
||||||
|
if isinstance(i.get("extra_option"), dict) and i['extra_option'].get('password'):
|
||||||
|
if not (current_user.username == "cmdb_agent" or current_user.uid == i['uid']):
|
||||||
|
i['extra_option'].pop('password', None)
|
||||||
|
else:
|
||||||
|
i['extra_option']['password'] = AESCrypto.decrypt(i['extra_option']['password'])
|
||||||
|
|
||||||
return self.jsonify(res)
|
return self.jsonify(res)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue