Correction de l’appel API et des constantes

This commit is contained in:
Benjamin Bohard 2021-12-08 08:24:20 +01:00
parent 1228dc1365
commit 59ae3af3c6
1 changed files with 7 additions and 7 deletions

View File

@ -93,11 +93,11 @@ def run_module():
"Gestion des identifiants ENT": 12, "Gestion des identifiants ENT": 12,
"Gestion de la réplication LDAP": 13, "Gestion de la réplication LDAP": 13,
"Gestion de la synchronisation AAF": 14, "Gestion de la synchronisation AAF": 14,
"Ecriture (serveurs)": 15, "Ecriture (serveurs)": 21,
"Ecriture (modules)": 16, "Ecriture (modules)": 22,
"Ecriture (etablissements)": 17, "Ecriture (etablissements)": 23,
"Actions sans modification de configuration": 18, "Actions sans modification de configuration": 31,
"Mise à jour du mot de passe (annuaire local)": 19, "Mise à jour du mot de passe (annuaire local)": 40,
} }
mapped_keys = {value: key for key, value in key_mapping.items()} mapped_keys = {value: key for key, value in key_mapping.items()}
@ -138,7 +138,7 @@ def run_module():
proxy_addr = "http://{0}:{1}@localhost:{2}/".format(module.params['zephir_user'], module.params['zephir_user_password'], port_zephir) proxy_addr = "http://{0}:{1}@localhost:{2}/".format(module.params['zephir_user'], module.params['zephir_user_password'], port_zephir)
proxy = EoleProxy(proxy_addr) proxy = EoleProxy(proxy_addr)
return_code, permissions = proxy.users.get_permissions(module.params['user']) return_code, permissions = proxy.get_permissions(module.params['user'])
if return_code: if return_code:
result['user'] = module.params['user'] result['user'] = module.params['user']
result['permissions'] = [mapped_keys[p] for p in permissions] result['permissions'] = [mapped_keys[p] for p in permissions]
@ -153,7 +153,7 @@ def run_module():
elif module.params['state'] == 'absent': elif module.params['state'] == 'absent':
permissions = old_permissions.difference(set(new_permissions)) permissions = old_permissions.difference(set(new_permissions))
return_code, proxy_msg = proxy.users.save_permissions(str(list(permissions))) return_code, proxy_msg = proxy.save_permissions(module.params['user'], str(list(permissions)))
if return_code: if return_code:
result['changed'] = True result['changed'] = True
result['permissions'] = [mapped_keys[p] for p in permissions] result['permissions'] = [mapped_keys[p] for p in permissions]