null pkey

If the pkey is null, send an empty array.
If the pkey is not null, send and array of length 1 with the pkey in it.

Addresses:  https://fedorahosted.org/freeipa/ticket/767
This commit is contained in:
Adam Young 2011-01-14 13:19:56 -05:00
parent c385db4fc0
commit 91fae67fa4

View File

@ -731,8 +731,6 @@ IPA.details_update = function (on_win, on_fail)
var that = this;
var entity_name = that.entity_name;
var pkey = that.get_primary_key();
function update_on_win(data, text_status, xhr) {
if (on_win)
on_win(data, text_status, xhr);
@ -748,13 +746,6 @@ IPA.details_update = function (on_win, on_fail)
on_fail(xhr, text_status, error_thrown);
}
/*
The check
if (!pkey) { return; }
used to happen here, but it breaks krbtpolicy, which allows a null pkey
and usually requires it.
*/
var values;
var modlist = {'all': true, 'setattr': [], 'addattr': [], 'rights': true};
var attrs_wo_option = {};
@ -800,7 +791,14 @@ IPA.details_update = function (on_win, on_fail)
}
}
IPA.cmd('mod', [pkey], modlist, update_on_win, null, entity_name);
var pkey = that.get_primary_key() ;
if (pkey){
pkey = [pkey];
}else{
pkey = [];
}
IPA.cmd('mod', pkey, modlist, update_on_win, null, entity_name);
}