mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
Add adapter attribute for choosing record
The new attribute of the adapter contains the name of record which will be extracted from API call result. Part of: https://fedorahosted.org/freeipa/ticket/5905 Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
This commit is contained in:
committed by
Petr Vobornik
parent
740099cf0b
commit
5a8ad3e982
@@ -801,6 +801,13 @@ field.Adapter = declare(null, {
|
|||||||
*/
|
*/
|
||||||
result_index: 0,
|
result_index: 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of the record which we want to extract from the result.
|
||||||
|
* Used in dnslocations.
|
||||||
|
* @type {String}
|
||||||
|
*/
|
||||||
|
result_name: 'result',
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extract record from RPC call response
|
* Extract record from RPC call response
|
||||||
*
|
*
|
||||||
@@ -821,10 +828,10 @@ field.Adapter = declare(null, {
|
|||||||
var dr = data.result;
|
var dr = data.result;
|
||||||
var record = null;
|
var record = null;
|
||||||
if (dr) {
|
if (dr) {
|
||||||
if (IPA.defined(dr.result)) record = dr.result;
|
if (IPA.defined(dr[this.result_name])) record = dr[this.result_name];
|
||||||
else if (dr.results) {
|
else if (dr.results) {
|
||||||
var result = dr.results[this.result_index];
|
var result = dr.results[this.result_index];
|
||||||
if (result) record = result.result;
|
if (result) record = result[this.result_name];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return record;
|
return record;
|
||||||
|
Reference in New Issue
Block a user