On 03/06/2013 01:42 PM, Petr Vobornik wrote:
On 03/02/2013 08:40 PM, Endi Sukma Dewata wrote:
----- Original Message -----
First two patches are bug fixes which are required for third patch.
Depends on my patch #259 (Combobox keyboard support)

1) [PATCH] Fix dirty state update of editable combobox

Editable combobox didn't update it's dirty state correctly. CB had
it's own internal value changed event, which was incorrectly used. It
was
removed and widget's value_changed event was used instead.

ACK.

Pushed to master

2) [PATCH] Fix handling of no_update flag in Web UI

There was an incorrect check for no_update flag. Check was performed
as if the flag was an attribute of object not an item of array. Hence,
the flag never caused any effect.

ACK.

Pushed to master

3) [PATCH] Global trust config page

https://fedorahosted.org/freeipa/ticket/3333

Just two notes:

ipantfallbackprimarygroup requires a posix group. Our API currently
doesn't support search based on object classes therefore the entity
select widget incorrectly offers non posix groups as well.

Are we planning to add the missing functionality? Right now you'll get
'group not found' if you select a non-POSIX group, which is confusing
because the group does exist. Possible solutions:


Waiting for "[RFE] Add option for filtering groups by type (posix,..) in
group-find command" to be implemented to solve issue.


Triaged to march and implemented. Patch 267 is on review.

This patch is modified accordingly.

8><-----


Another problem is that hidden 'Default SMB Group' is not listed.
Hence it couldn't be set again after a modification. I made the combobox
editable (first usage, so it revealed a bug) to avoid this problem.
User can enter garbage, but the framework should handle that.

This is a little difficult to use. You'll need to know that you have to
type 'Default SMB Group' to go back to the default and the UI doesn't
show that as an acceptable value. Possible solutions:

1. Add the 'Default SMB Group' as the first entry in the drop down list
so you can reselect it again. The drop down list doesn't need to be
editable.

2. Use radio buttons to separate the default value from other values:

   Fallback primary group: (o) Default SMB Group
                           ( ) POSIX group: [ drop down list ]

Regardless, I think the server API needs to be changed to accept an
empty value to go back to the default value instead of taking 'Default
SMB Group'. A default value should be simple and not something that will
potentially conflict with a non-default value that happens to have the
same name.

I agree. Martin is it feasible?

From other emails: Apparently its not worth the time. So I implemented #1.

3. Found an issue: trusctconfig-show will raise 'not found' error when trusts are not configured on a system. It's fixed separately in attached patch #268. It has similar behavior as dns pages.

Also I added data .json files to patch 262 and 268, so the static version can be used.

--
Endi S. Dewata
--
Petr Vobornik
From 146e1b8d084399a7cf3518d1f7be08137c97a33a Mon Sep 17 00:00:00 2001
From: Petr Vobornik <pvobo...@redhat.com>
Date: Tue, 12 Mar 2013 17:00:32 +0100
Subject: [PATCH] Don't show trusts pages when trust is not configured

When trust is not configured trust-config page is raising an error. Trusts search page won't find anything either -> no use for the pages -> hiding.

https://fedorahosted.org/freeipa/ticket/3333
---
 install/ui/src/freeipa/ipa.js      | 12 +++++++++++-
 install/ui/src/freeipa/trust.js    | 14 ++++++++++++++
 install/ui/test/data/ipa_init.json | 25 ++++++++++++++++++++++++-
 3 files changed, 49 insertions(+), 2 deletions(-)

diff --git a/install/ui/src/freeipa/ipa.js b/install/ui/src/freeipa/ipa.js
index 0d5c0bbdc5d2346c291260781d253010019bd65a..c1ed722144967e87e4e7c4937aea2db50be0d669 100644
--- a/install/ui/src/freeipa/ipa.js
+++ b/install/ui/src/freeipa/ipa.js
@@ -140,7 +140,17 @@ var IPA = function() {
             }
         }));
 
-
+        batch.add_command(IPA.command({
+            entity: 'trustconfig',
+            method: 'show',
+            retry: false,
+            on_success: function(data, text_status, xhr) {
+                that.trust_enabled = true;
+            },
+            on_error: function(xhr, text_status, error_thrown) {
+                that.trust_enabled = false;
+            }
+        }));
 
         batch.execute();
     };
diff --git a/install/ui/src/freeipa/trust.js b/install/ui/src/freeipa/trust.js
index b79379746e32c121f27938fc313368b86fa6a24b..964f94988b3f1c7aaa1b9e79bf63f8f3fbf656da 100644
--- a/install/ui/src/freeipa/trust.js
+++ b/install/ui/src/freeipa/trust.js
@@ -28,6 +28,13 @@ IPA.trust.entity = function(spec) {
     var that = IPA.entity(spec);
 
     that.init = function() {
+
+        if (!IPA.trust_enabled) {
+            throw {
+                expected: true
+            };
+        }
+
         that.entity_init();
 
         that.builder.search_facet({
@@ -198,6 +205,13 @@ IPA.trust.config_entity = function(spec) {
     var that = IPA.entity(spec);
 
     that.init = function() {
+
+        if (!IPA.trust_enabled) {
+            throw {
+                expected: true
+            };
+        }
+
         that.entity_init();
 
         that.builder.details_facet({
diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json
index 234258292cdb1be1e9ddc3e9324c4171b3c7b292..bab88a203d7aa73b34a179ed20ec16c5e314d927 100644
--- a/install/ui/test/data/ipa_init.json
+++ b/install/ui/test/data/ipa_init.json
@@ -2,7 +2,7 @@
     "error": null,
     "id": null,
     "result": {
-        "count": 4,
+        "count": 5,
         "results": [
             {
                 "error": null,
@@ -755,6 +755,29 @@
                 "result": true,
                 "summary": null,
                 "value": ""
+            },
+            {
+                "error": null,
+                "result": {
+                    "cn": [
+                        "test.example.com"
+                    ],
+                    "dn": "cn=test.example.com,cn=etc,dc=test,dc=example,dc=com",
+                    "ipantdomainguid": [
+                        "ae391b8e-a104-476f-a7ee-146239a31dde"
+                    ],
+                    "ipantfallbackprimarygroup": [
+                        "Default SMB Group"
+                    ],
+                    "ipantflatname": [
+                        "EXAMPLE"
+                    ],
+                    "ipantsecurityidentifier": [
+                        "S-1-5-21-1849636185-3637193423-921922997"
+                    ]
+                },
+                "summary": null,
+                "value": "ad"
             }
         ]
     }
-- 
1.8.1.4

From 2fa6d1efdbb2cd86849c1507acaf4801ca5a80f1 Mon Sep 17 00:00:00 2001
From: Petr Vobornik <pvobo...@redhat.com>
Date: Mon, 11 Feb 2013 12:56:35 +0100
Subject: [PATCH] Global trust config page

https://fedorahosted.org/freeipa/ticket/3333

review changes
---
 install/ui/src/freeipa/trust.js              |  85 ++++++++++++++++++++
 install/ui/src/freeipa/webui.js              |   7 +-
 install/ui/src/freeipa/widget.js             |   6 +-
 install/ui/test/data/ipa_init.json           |   6 +-
 install/ui/test/data/ipa_init_objects.json   | 113 +++++++++++++++++++++++++++
 install/ui/test/data/trustconfigad_show.json |  41 ++++++++++
 ipalib/plugins/internal.py                   |   4 +
 7 files changed, 259 insertions(+), 3 deletions(-)
 create mode 100644 install/ui/test/data/trustconfigad_show.json

diff --git a/install/ui/src/freeipa/trust.js b/install/ui/src/freeipa/trust.js
index e4a227ab737b6ee8eacc9b1d99df7d6ac78f0e31..b79379746e32c121f27938fc313368b86fa6a24b 100644
--- a/install/ui/src/freeipa/trust.js
+++ b/install/ui/src/freeipa/trust.js
@@ -193,7 +193,92 @@ IPA.trust.adder_dialog = function(spec) {
     return that;
 };
 
+IPA.trust.config_entity = function(spec) {
+
+    var that = IPA.entity(spec);
+
+    that.init = function() {
+        that.entity_init();
+
+        that.builder.details_facet({
+            factory: IPA.trust.config_details_facet,
+            trust_type:  'ad',
+            sections: [
+                {
+                    name: 'details',
+                    label: IPA.messages.objects.trustconfig.options,
+                    fields: [
+                        'cn',
+                        'ipantsecurityidentifier',
+                        'ipantflatname',
+                        'ipantdomainguid',
+                        {
+                            type: 'trust_fallbackgroup_select',
+                            name: 'ipantfallbackprimarygroup',
+                            other_entity: 'group',
+                            other_field: 'cn',
+                            empty_option: false,
+                            filter_options: {
+                                type: 'posix'
+                            }
+                        }
+                    ]
+                }
+            ]
+        });
+    };
+
+    return that;
+};
+
+IPA.trust.config_details_facet = function(spec) {
+
+    spec = spec || {};
+
+    var that = IPA.details_facet(spec);
+
+    that.trust_type = spec.trust_type;
+
+    that.get_refresh_command_name = function() {
+        return that.entity.name+that.trust_type+'_show';
+    };
+
+    that.create_refresh_command = function() {
+
+        var command = that.details_facet_create_refresh_command();
+        command.set_option('trust_type', that.trust_type);
+
+        return command;
+    };
+
+    that.create_update_command = function() {
+
+        var command = that.details_facet_create_update_command();
+        command.set_option('trust_type', that.trust_type);
+
+        return command;
+    };
+
+    return that;
+};
+
+IPA.trust.fallbackgroup_select_widget = function(spec) {
+    var that = IPA.entity_select_widget(spec);
+
+    that.set_options = function(options) {
+        // always add 'Default SMB Group', it can't be obtained by group-find.
+        options.unshift('Default SMB Group');
+        that.entity_select_set_options(options);
+    };
+
+    return that;
+};
+
+IPA.widget_factories['trust_fallbackgroup_select'] = IPA.trust.fallbackgroup_select_widget;
+IPA.field_factories['trust_fallbackgroup_select'] = IPA.field_factories['entity_select'];
+
 IPA.register('trust', IPA.trust.entity);
+IPA.register('trustconfig', IPA.trust.config_entity);
 
 return {};
 });
\ No newline at end of file
diff --git a/install/ui/src/freeipa/webui.js b/install/ui/src/freeipa/webui.js
index f6c3339ec4b5d3fb8a4cb547407eebf2a19b45af..48ca2e09c122dd155a29d299ef52227b3798e6a1 100644
--- a/install/ui/src/freeipa/webui.js
+++ b/install/ui/src/freeipa/webui.js
@@ -82,7 +82,12 @@ IPA.admin_navigation = function(spec) {
             {entity: 'selfservice'},
             {entity: 'delegation'},
             {entity: 'idrange'},
-            {entity: 'trust'},
+            {
+                name: 'trusts', label: IPA.messages.tabs.trust, children:[
+                    {entity: 'trust'},
+                    {entity: 'trustconfig'}
+                ]
+            },
             {entity: 'config'}
         ]}];
 
diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js
index 6472cab971385d31247639c3e526c9e8f0b9063c..82de8d1a35dbb8b9b646f60473f0094b791e408d 100644
--- a/install/ui/src/freeipa/widget.js
+++ b/install/ui/src/freeipa/widget.js
@@ -2500,12 +2500,14 @@ IPA.entity_select_widget = function(spec) {
     that.other_field = spec.other_field;
 
     that.options = spec.options || [];
+    that.filter_options = spec.filter_options || {};
 
     that.create_search_command = function(filter) {
         return IPA.command({
             entity: that.other_entity.name,
             method: 'find',
-            args: [filter]
+            args: [filter],
+            options: that.filter_options
         });
     };
 
@@ -2539,6 +2541,8 @@ IPA.entity_select_widget = function(spec) {
         if (that.on_search_success) that.on_search_success.call(this, data, text_status, xhr);
     };
 
+    that.entity_select_set_options = that.set_options;
+
     return that;
 };
 
diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json
index 73d54578b19c53de15c237472a46312fa5e30ccc..234258292cdb1be1e9ddc3e9324c4171b3c7b292 100644
--- a/install/ui/test/data/ipa_init.json
+++ b/install/ui/test/data/ipa_init.json
@@ -458,6 +458,9 @@
                             "truststatus": "Trust status",
                             "trusttype": "Trust type"
                         },
+                        "trustconfig": {
+                            "options": "Options"
+                        },
                         "user": {
                             "account": "Account Settings",
                             "account_status": "Account Status",
@@ -516,7 +519,8 @@
                         "ipaserver": "IPA Server",
                         "policy": "Policy",
                         "role": "Role Based Access Control",
-                        "sudo": "Sudo"
+                        "sudo": "Sudo",
+                        "trust": "Trusts"
                     },
                     "true": "True",
                     "widget": {
diff --git a/install/ui/test/data/ipa_init_objects.json b/install/ui/test/data/ipa_init_objects.json
index 6458e4cdaa5c64ee0bd82df67508b002bc4446fb..e42002c3f5817feaef0d1fac04af157d4fcc5217 100644
--- a/install/ui/test/data/ipa_init_objects.json
+++ b/install/ui/test/data/ipa_init_objects.json
@@ -7263,6 +7263,119 @@
                 ],
                 "uuid_attribute": ""
             },
+            "trustconfig": {
+                "aciattrs": [],
+                "attribute_members": {},
+                "bindable": false,
+                "container_dn": "",
+                "default_attributes": [
+                    "cn",
+                    "ipantsecurityidentifier",
+                    "ipantflatname",
+                    "ipantdomainguid",
+                    "ipantfallbackprimarygroup"
+                ],
+                "hidden_attributes": [
+                    "objectclass",
+                    "aci"
+                ],
+                "label": "Global Trust Configuration",
+                "label_singular": "Global Trust Configuration",
+                "methods": [
+                    "mod",
+                    "show"
+                ],
+                "name": "trustconfig",
+                "object_class": [],
+                "object_class_config": null,
+                "object_name": "trust configuration",
+                "object_name_plural": "entries",
+                "parent_object": "",
+                "rdn_attribute": "",
+                "relationships": {
+                    "member": [
+                        "Member",
+                        "",
+                        "no_"
+                    ],
+                    "memberindirect": [
+                        "Indirect Member",
+                        null,
+                        "no_indirect_"
+                    ],
+                    "memberof": [
+                        "Member Of",
+                        "in_",
+                        "not_in_"
+                    ],
+                    "memberofindirect": [
+                        "Indirect Member Of",
+                        null,
+                        "not_in_indirect_"
+                    ]
+                },
+                "takes_params": [
+                    {
+                        "class": "Str",
+                        "doc": "Domain",
+                        "flags": [
+                            "no_update"
+                        ],
+                        "label": "Domain",
+                        "name": "cn",
+                        "noextrawhitespace": true,
+                        "required": true,
+                        "type": "unicode"
+                    },
+                    {
+                        "class": "Str",
+                        "doc": "Security Identifier",
+                        "flags": [
+                            "no_update"
+                        ],
+                        "label": "Security Identifier",
+                        "name": "ipantsecurityidentifier",
+                        "noextrawhitespace": true,
+                        "required": true,
+                        "type": "unicode"
+                    },
+                    {
+                        "class": "Str",
+                        "doc": "NetBIOS name",
+                        "flags": [
+                            "no_update"
+                        ],
+                        "label": "NetBIOS name",
+                        "name": "ipantflatname",
+                        "noextrawhitespace": true,
+                        "required": true,
+                        "type": "unicode"
+                    },
+                    {
+                        "class": "Str",
+                        "doc": "Domain GUID",
+                        "flags": [
+                            "no_update"
+                        ],
+                        "label": "Domain GUID",
+                        "name": "ipantdomainguid",
+                        "noextrawhitespace": true,
+                        "required": true,
+                        "type": "unicode"
+                    },
+                    {
+                        "class": "Str",
+                        "doc": "Fallback primary group",
+                        "flags": [],
+                        "label": "Fallback primary group",
+                        "name": "ipantfallbackprimarygroup",
+                        "noextrawhitespace": true,
+                        "required": true,
+                        "type": "unicode"
+                    }
+                ],
+                "uuid_attribute": ""
+            },
             "user": {
                 "aciattrs": [
                     "audio",
diff --git a/install/ui/test/data/trustconfigad_show.json b/install/ui/test/data/trustconfigad_show.json
new file mode 100644
index 0000000000000000000000000000000000000000..648c8e58a3cfc82f668993112a8a1d0b5cb2a829
--- /dev/null
+++ b/install/ui/test/data/trustconfigad_show.json
@@ -0,0 +1,41 @@
+{
+    "error": null,
+    "id": null,
+    "result": {
+        "result": {
+            "attributelevelrights": {
+                "aci": "rscwo",
+                "cn": "rscwo",
+                "ipantdomainguid": "rscwo",
+                "ipantfallbackprimarygroup": "rscwo",
+                "ipantflatname": "rscwo",
+                "ipantsecurityidentifier": "rscwo",
+                "nsaccountlock": "rscwo",
+                "objectclass": "rscwo"
+            },
+            "cn": [
+                "test.example.com"
+            ],
+            "dn": "cn=test.example.com,cn=etc,dc=test,dc=example,dc=com",
+            "ipantdomainguid": [
+                "ae391b8e-a104-476f-a7ee-146239a31dde"
+            ],
+            "ipantfallbackprimarygroup": [
+                "Default SMB Group"
+            ],
+            "ipantflatname": [
+                "EXAMPLE"
+            ],
+            "ipantsecurityidentifier": [
+                "S-1-5-21-1849636185-3637193423-921922997"
+            ],
+            "objectclass": [
+                "ipaNTDomainAttrs",
+                "nsContainer",
+                "top"
+            ]
+        },
+        "summary": null,
+        "value": "ad"
+    }
+}
\ No newline at end of file
diff --git a/ipalib/plugins/internal.py b/ipalib/plugins/internal.py
index 2ca112ee0816a23d2b341d9a79b9447da41c506b..28753148453ad9678a7e227b732190117fbe7059 100644
--- a/ipalib/plugins/internal.py
+++ b/ipalib/plugins/internal.py
@@ -597,6 +597,9 @@ class i18n_messages(Command):
                 "truststatus": _("Trust status"),
                 "trusttype": _("Trust type"),
             },
+            "trustconfig": {
+                "options": _("Options"),
+            },
             "user": {
                 "account": _("Account Settings"),
                 "account_status": _("Account Status"),
@@ -656,6 +659,7 @@ class i18n_messages(Command):
             "policy": _("Policy"),
             "role": _("Role Based Access Control"),
             "sudo": _("Sudo"),
+            "trust": _("Trusts"),
         },
         "true": _("True"),
         "widget": {
-- 
1.8.1.4

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

Reply via email to