Re: [Freeipa-devel] [PATCH] Fixed association links

2010-12-03 Thread Adam Young

On 12/03/2010 12:39 PM, Endi Sukma Dewata wrote:

On 12/2/2010 9:15 PM, Adam Young wrote:

You should be filtering out Host-> Enrolled by Users as well.
This is a single entity field, and it is automatically filled out 
when the user enrolls the host in IPA.

That will fix
https://fedorahosted.org/freeipa/ticket/377

Don't forget to update test/date/ipa_init.json with the new messages.

Rest of it looks good.


Attached is an updated patch.

The enrolledby is now filtered out as well. The plugin and test data 
have been updated to match the wordings in ticket #511.



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

ACK.  Pushed to master

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

Re: [Freeipa-devel] [PATCH] Fixed association links

2010-12-03 Thread Endi Sukma Dewata

On 12/2/2010 9:15 PM, Adam Young wrote:

You should be filtering out Host-> Enrolled by Users as well.
This is a single entity field, and it is automatically filled out when the user 
enrolls the host in IPA.
That will fix
https://fedorahosted.org/freeipa/ticket/377

Don't forget to update test/date/ipa_init.json with the new messages.

Rest of it looks good.


Attached is an updated patch.

The enrolledby is now filtered out as well. The plugin and test data 
have been updated to match the wordings in ticket #511.


--
Endi S. Dewata
From 470d3c27c745200a87c19e5a8187454a53c527b3 Mon Sep 17 00:00:00 2001
From: Endi S. Dewata 
Date: Thu, 2 Dec 2010 17:16:34 -0600
Subject: [PATCH] Fixed association links

The create_association_facets() has been modified such that it
does not generate duplicate links. This is done by assigning the
proper labels and hiding non-assignable associations.

Each association will get a label based on the attribute used:
 - memberof: Membership in 
 - member.*:  Members
 - managedby: Managed by 

The following associations will be hidden:
 - memberindirect
 - enrolledby

The internal.py was modified to return localized labels.

The test data has been updated.
---
 install/static/entity.js   |   24 
 install/static/group.js|2 +-
 install/static/hbacsvcgroup.js |2 +-
 install/static/host.js |2 +-
 install/static/service.js  |2 +-
 install/static/sudocmdgroup.js |2 +-
 install/static/test/data/ipa_init.json |5 +
 ipalib/plugins/internal.py |4 
 8 files changed, 34 insertions(+), 9 deletions(-)

diff --git a/install/static/entity.js b/install/static/entity.js
index 6e2b501b0989b4549123888bef0fcc69a7b23b0d..548623e2d838bfa931d50273fee16132d1cb0499 100644
--- a/install/static/entity.js
+++ b/install/static/entity.js
@@ -151,9 +151,7 @@ function ipa_entity(spec) {
 return config;
 };
 
-that.create_association_facet = function(other_entity, attribute_member) {
-
-var label = IPA.metadata[other_entity].label;
+that.create_association_facet = function(attribute_member, other_entity, label) {
 
 if (!attribute_member) {
 attribute_member = ipa_get_member_attribute(
@@ -173,12 +171,30 @@ function ipa_entity(spec) {
 var attribute_members = IPA.metadata[that.name].attribute_members;
 
 for (var attribute_member in attribute_members) {
+
+// skip non-assignable associations
+if (attribute_member === 'memberindirect') continue;
+if (attribute_member === 'enrolledby') continue;
+
 var other_entities = attribute_members[attribute_member];
 
 for (var j = 0; j < other_entities.length; j++) {
 var other_entity = other_entities[j];
+var other_entity_name = IPA.metadata[other_entity].label;
 
-var facet = that.create_association_facet(other_entity, attribute_member);
+var label = other_entity_name;
+
+if (attribute_member.match(/^memberof$/)) {
+label = IPA.messages.association.membershipin+' '+other_entity_name;
+
+} else if (attribute_member.match(/^member/)) {
+label = other_entity_name+' '+IPA.messages.association.members;
+
+} else if (attribute_member.match(/^managedby$/)) {
+label = IPA.messages.association.managedby+' '+other_entity_name;
+}
+
+var facet = that.create_association_facet(attribute_member, other_entity, label);
 if (that.get_facet(facet.name)) continue;
 that.add_facet(facet);
 }
diff --git a/install/static/group.js b/install/static/group.js
index bcac40982d1bddaec55bdb46173df0b65e2bfb68..b44463439d73d6059b32751c07530c41b6d1a4dc 100644
--- a/install/static/group.js
+++ b/install/static/group.js
@@ -64,7 +64,7 @@ function ipa_group() {
 
 facet = ipa_group_member_user_facet({
 'name': 'member_user',
-'label': 'Users',
+'label': IPA.metadata['user'].label+' '+IPA.messages.association.members,
 'other_entity': 'user'
 });
 that.add_facet(facet);
diff --git a/install/static/hbacsvcgroup.js b/install/static/hbacsvcgroup.js
index 9cc1cdea4fba86c36ab99fbcf2f96ceda50b99b1..94a79c026a5846632534508de427bc8e1474ab4b 100755
--- a/install/static/hbacsvcgroup.js
+++ b/install/static/hbacsvcgroup.js
@@ -55,7 +55,7 @@ function ipa_hbacsvcgroup() {
 
 facet = ipa_hbacsvcgroup_member_hbacsvc_facet({
 'name': 'member_hbacsvc',
-'label': 'Services',
+'label': IPA.metadata['hbacsvc'].label+' '+IPA.messages.association.members,
 'other_entity': 'hbacsvc'
 });
 that.add_facet(facet);
diff --git a/install/static/host.js b/install/static/host.js
index 4f3a6