This is necessary, but not sure if it is suffcieint. THere is at least one problem still: group->users doesn't allow enrollment. Need to fix that, but should be in a follow on patch.
From a8080d963dac0d7769d32dfc74efbec99bbb7125 Mon Sep 17 00:00:00 2001
From: Adam Young <ayo...@redhat.com>
Date: Mon, 31 Jan 2011 19:17:39 -0500
Subject: [PATCH] association fixes

PLaces custom association facets into the proper facet groups
usesthe associators if they are specifiedfor an association
---
 install/ui/entity.js |   34 ++++++++++++++++++++++++++--------
 1 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/install/ui/entity.js b/install/ui/entity.js
index 7f195a147dad7e09e4f2b9b666553ce4e23ea94c..951b58798fd2a675e7c3f09a5720b29363042f05 100644
--- a/install/ui/entity.js
+++ b/install/ui/entity.js
@@ -180,13 +180,35 @@ IPA.entity = function (spec) {
                 that.entity_name, other_entity);
         }
 
-        return IPA.association_facet({
-            'name': attribute_member+'_'+other_entity,
+        var association_name= attribute_member+'_'+other_entity;
+
+        //TODO remove from the facets and facets_by_name collections
+        var facet = that.get_facet(association_name);
+        if (facet){
+            facet.facet_group = facet_group;
+            return;
+        }
+
+        var config = that.get_association(other_entity);
+        if (!config){
+            config = that.get_association(association_name);
+        }
+
+        var spec ={
+            'name': association_name,
             'label': label,
             'other_entity': other_entity,
             'facet_group': facet_group,
             'attribute_member': attribute_member
-        });
+        };
+
+        if (config){
+            spec.associator = config.associator;
+        }
+
+        facet =  IPA.association_facet(spec);
+
+        that.add_facet(facet);
     };
 
     that.create_association_facets = function() {
@@ -214,12 +236,8 @@ IPA.entity = function (spec) {
                     relationship = ['Member', '', 'no_'];
                 var facet_group = relationship[0];
 
-                var facet = that.create_association_facet(
+                that.create_association_facet(
                     attribute_member, other_entity, label, facet_group);
-
-                if (that.get_facet(facet.name)) continue;
-
-                that.add_facet(facet);
             }
         }
         return that;
-- 
1.7.3.5

_______________________________________________
Freeipa-devel mailing list
Freeipa-devel@redhat.com
https://www.redhat.com/mailman/listinfo/freeipa-devel

Reply via email to