mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2024-12-24 16:10:02 -06:00
Allow to set another other_entity name
Association table's add, del commands needs as option list of cn of other_entity, which is added or deleted. There is a case (currently in vaults) that the name of option is different than the name of other_entity. In this situation we can set 'other_option_name' and put there the option name. This option name will be used instead of 'other_entity' name. Part of: https://fedorahosted.org/freeipa/ticket/5426 Reviewed-By: Martin Basti <mbasti@redhat.com> Reviewed-By: Petr Vobornik <pvoborni@redhat.com>
This commit is contained in:
parent
c3115fa617
commit
ec63456b7c
@ -429,6 +429,22 @@ IPA.association_table_widget = function (spec) {
|
||||
*/
|
||||
that.additional_add_del_field = spec.additional_add_del_field;
|
||||
|
||||
/**
|
||||
* Can be used in situations when the *_add_member command needs entity
|
||||
* as a parameter, but parameter has different name than entity.
|
||||
* i.e. vault_add_member --services=[values] ... this needs values from service
|
||||
* entity, but option is called services, that we can set by setting
|
||||
* this option in spec to other_option_name: 'services'
|
||||
*
|
||||
* @property {String} other_option_name
|
||||
*/
|
||||
that.other_option_name = spec.other_option_name;
|
||||
|
||||
/**
|
||||
* Entity which is added into member table.
|
||||
*
|
||||
* @property {String} other_entity
|
||||
*/
|
||||
that.other_entity = IPA.get_entity(spec.other_entity);
|
||||
that.attribute_member = spec.attribute_member;
|
||||
|
||||
@ -683,9 +699,9 @@ IPA.association_table_widget = function (spec) {
|
||||
on_success: on_success,
|
||||
on_error: on_error
|
||||
});
|
||||
command.set_option(that.other_entity.name, values);
|
||||
|
||||
that.join_additional_option(command);
|
||||
that.handle_entity_option(command, values);
|
||||
|
||||
command.execute();
|
||||
};
|
||||
@ -701,6 +717,14 @@ IPA.association_table_widget = function (spec) {
|
||||
}
|
||||
};
|
||||
|
||||
that.handle_entity_option = function(command, values) {
|
||||
var option_name = that.other_option_name;
|
||||
if (!option_name) {
|
||||
option_name = that.other_entity.name;
|
||||
}
|
||||
command.set_option(option_name, values);
|
||||
};
|
||||
|
||||
that.show_remove_dialog = function() {
|
||||
|
||||
var selected_values = that.get_selected_values();
|
||||
@ -745,7 +769,6 @@ IPA.association_table_widget = function (spec) {
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
dialog.open();
|
||||
};
|
||||
|
||||
@ -761,8 +784,8 @@ IPA.association_table_widget = function (spec) {
|
||||
on_error: on_error
|
||||
});
|
||||
|
||||
command.set_option(that.other_entity.name, values);
|
||||
that.join_additional_option(command);
|
||||
that.handle_entity_option(command, values);
|
||||
|
||||
command.execute();
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user