Hi,

This patch partially fix this bug:
https://fedorahosted.org/freeipa/ticket/534

The SUDO details page has been modified to support external users
and hosts. In the backend, the internal and external users are kept
in separate attributes, but in the UI they will be displayed as a
single list. The same thing is done for hosts.

--
Endi S. Dewata

From 3874a0f8bd1977152f08cfaf53bc4ac18ca89453 Mon Sep 17 00:00:00 2001
From: Endi S. Dewata <edew...@redhat.com>
Date: Wed, 5 Jan 2011 11:13:08 +0700
Subject: [PATCH] Support for external SUDO users and hosts.

The SUDO details page has been modified to support external users
and hosts. In the backend, the internal and external users are kept
in separate attributes, but in the UI they will be displayed as a
single list. The same thing is done for hosts.
---
 install/static/sudorule.js                  |   17 +++++++++++++++--
 install/static/test/data/sudorule_show.json |    6 ++++++
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/install/static/sudorule.js b/install/static/sudorule.js
index 219671b206e9b5c80be33b3623585e2e982ff025..4400ce7588ee1ab6b05dab2289507ddd5ce03b73 100755
--- a/install/static/sudorule.js
+++ b/install/static/sudorule.js
@@ -137,7 +137,8 @@ function ipa_sudorule_details_facet(spec) {
         section.add_field(ipa_sudorule_association_table_widget({
             'id': that.entity_name+'-memberuser_user',
             'name': 'memberuser_user', 'label': 'Users', 'category': category,
-            'other_entity': 'user', 'add_method': 'add_user', 'remove_method': 'remove_user'
+            'other_entity': 'user', 'add_method': 'add_user', 'remove_method': 'remove_user',
+            'external_attribute': 'externaluser'
         }));
         section.add_field(ipa_sudorule_association_table_widget({
             'id': that.entity_name+'-memberuser_group',
@@ -164,7 +165,8 @@ function ipa_sudorule_details_facet(spec) {
         section.add_field(ipa_sudorule_association_table_widget({
             'id': that.entity_name+'-memberhost_host',
             'name': 'memberhost_host', 'label': 'Host', 'category': category,
-            'other_entity': 'host', 'add_method': 'add_host', 'remove_method': 'remove_host'
+            'other_entity': 'host', 'add_method': 'add_host', 'remove_method': 'remove_host',
+            'external_attribute': 'externalhost'
         }));
         section.add_field(ipa_sudorule_association_table_widget({
             'id': that.entity_name+'-memberhost_hostgroup',
@@ -745,6 +747,8 @@ function ipa_sudorule_association_table_widget(spec) {
 
     var that = ipa_rule_association_table_widget(spec);
 
+    that.external_attribute = spec.external_attribute;
+
     that.create_add_dialog = function() {
         var pkey = $.bbq.getState(that.entity_name + '-pkey', true) || '';
         var label = IPA.metadata[that.other_entity].label;
@@ -764,6 +768,15 @@ function ipa_sudorule_association_table_widget(spec) {
         });
     };
 
+    that.load = function(result) {
+        that.values = result[that.name] || [];
+        if (that.external_attribute) {
+            var external_values = result[that.external_attribute] || [];
+            $.merge(that.values, external_values);
+        }
+        that.reset();
+    };
+
     return that;
 }
 
diff --git a/install/static/test/data/sudorule_show.json b/install/static/test/data/sudorule_show.json
index 6f4b47526815ee114d9f7602cef2217c7605e406..5d8473259c15c0452f9fbeca1166dc1161dcbbad 100644
--- a/install/static/test/data/sudorule_show.json
+++ b/install/static/test/data/sudorule_show.json
@@ -32,6 +32,12 @@
                 "test"
             ],
             "dn": "ipauniqueid=4fc57a02-f23311df-b268e50e-a3b3ef71,cn=sudorules,dc=dev,dc=example,dc=com",
+            "externalhost": [
+                "external.example.com"
+            ],
+            "externaluser": [
+                "external"
+            ],
             "ipasudorunas_user": [
                 "admin"
             ],
-- 
1.6.6.1

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

Reply via email to