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
3ad8378eab
commit
39145989c3
|
@ -273,6 +273,12 @@ class AutoDiscoveryCITypeCRUD(DBMixin):
|
|||
result.append(rule)
|
||||
break
|
||||
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'])
|
||||
if not adr:
|
||||
continue
|
||||
|
|
|
@ -149,6 +149,11 @@ class AutoDiscoveryCITypeView(APIView):
|
|||
i['extra_option'].pop('secret', None)
|
||||
else:
|
||||
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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue