Ticket: https://fedorahosted.org/freeipa/ticket/4507

Support for delegating RBAC roles to service principals added new attribute members. [1][2] Most of Web UI was automatically extended but the defaults chose wrong associator for service's memberof_role facet

traditionally it would be solved by

       {
            $type: 'association',
            name: 'memberof_role',
            associator: IPA.serial_associator
        }

This patch tries to make the auto-magic functionality little bit less stupid to eliminate a need for ^^ patches. It's far from perfect - doesn't support things like:

       {
            $type: 'association',
            name: 'memberof_sudorule',
            associator: IPA.serial_associator,
            add_method: 'add_user',
            remove_method: 'remove_user'
        }

[1] https://git.fedorahosted.org/cgit/freeipa.git/commit/?id=8fabd6dde152fc394bd4f093d93c8a46e5b2851b
[2] https://fedorahosted.org/freeipa/ticket/3164

--
Petr Vobornik
From 21d2df52e89f4e6fb3576f9e81e6e7e3c094fee1 Mon Sep 17 00:00:00 2001
From: Petr Vobornik <[email protected]>
Date: Fri, 22 Aug 2014 17:58:48 +0200
Subject: [PATCH] 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
---
 install/ui/src/freeipa/association.js | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/install/ui/src/freeipa/association.js b/install/ui/src/freeipa/association.js
index b78903ad734af6488cd9902bc5af2885f99c6bb3..8fe612e913c3fc8bb8c2fa86423eb4b46f224ddc 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;
 
-- 
1.9.3

_______________________________________________
Freeipa-devel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to