summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Vobornik <pvoborni@redhat.com>2014-08-22 17:58:48 +0200
committerPetr Vobornik <pvoborni@redhat.com>2014-09-08 12:45:29 +0200
commitf70eafaedbdc4a511338979198f9459ee5b47807 (patch)
treeb8bbec0ff0f90e6d1cc9da92bbdb3e9544bd9a83
parent5e36cc5215209294c9728fa4c2034d4c248acd68 (diff)
downloadfreeipa-f70eafaedbdc4a511338979198f9459ee5b47807.tar.gz
freeipa-f70eafaedbdc4a511338979198f9459ee5b47807.tar.xz
freeipa-f70eafaedbdc4a511338979198f9459ee5b47807.zip
webui: switch associators if default doesn't work
Make association auto-magic little bit less stupid. Now it supports adding of new attribute member with add_member and remove_member methods only on one side of the relationship. https://fedorahosted.org/freeipa/ticket/4507 Reviewed-By: Endi Sukma Dewata <edewata@redhat.com>
-rw-r--r--install/ui/src/freeipa/association.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/install/ui/src/freeipa/association.js b/install/ui/src/freeipa/association.js
index b78903ad7..8fe612e91 100644
--- a/install/ui/src/freeipa/association.js
+++ b/install/ui/src/freeipa/association.js
@@ -826,6 +826,16 @@ exp.association_facet_pre_op = function(spec, context) {
spec.other_entity = spec.other_entity ||
spec.name.substring(index+1);
+ if (!spec.associator) {
+ // batch associator (default) calls entity_command, serial associator
+ // calls other_entity_command --> if entity doesn't support the command,
+ // switch associators to try the other_entity
+ var add_command = spec.add_command || 'add_member';
+ if (!metadata_provider.get('@mc:'+entity.name+'_'+add_command)) {
+ spec.associator = IPA.serial_associator;
+ }
+ }
+
spec.add_title = '@i18n:association.add.'+spec.attribute_member;
spec.remove_title = '@i18n:association.remove.'+spec.attribute_member;