On 03/19/2013 05:04 AM, Endi Sukma Dewata wrote:
On 3/18/2013 6:30 AM, Petr Vobornik wrote:
The static page and the code looks good, but do you have a live server
that I could take a look at?

https://xxxx/ipa/ui/#trusts=trustconfig&ipaserver=trusts&navigation=ipaserver


Thanks. ACK.


pushed to master (262-2, 268)

262-2 has a one-liner change because of API change of group-find command.

< +                                type: 'posix'
> +                                posix: true
--
Petr Vobornik
From 1794b3262157f544df6c72537a843bd89f3a3a97 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
---
 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..25ddb5cdf307d4b38e99517e59ff436730c1bcb0 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: {
+                                posix: true
+                            }
+                        }
+                    ]
+                }
+            ]
+        });
+    };
+
+    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 5315f3acf32f69160169a380e64f6400481cfd0d..db1dab07e7dba696b4e4566d8797e66a93562b9e 100644
--- a/install/ui/src/freeipa/webui.js
+++ b/install/ui/src/freeipa/webui.js
@@ -84,7 +84,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 44b8611a3ce7a6f02d1fd259d9a59b03a80dc733..17d9b8b7718bf0a964668fc66b53b1bcc1512624 100644
--- a/install/ui/src/freeipa/widget.js
+++ b/install/ui/src/freeipa/widget.js
@@ -2734,12 +2734,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
         });
     };
 
@@ -2773,6 +2775,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 a75918eb22573d6b4114242d99f972f59050d060..38ef3ce4c614f4f051df323c50840cb6e47d6e28 100644
--- a/install/ui/test/data/ipa_init.json
+++ b/install/ui/test/data/ipa_init.json
@@ -488,6 +488,9 @@
                             "truststatus": "Trust status",
                             "trusttype": "Trust type"
                         },
+                        "trustconfig": {
+                            "options": "Options"
+                        },
                         "user": {
                             "account": "Account Settings",
                             "account_status": "Account Status",
@@ -547,7 +550,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 bf14222d734948cbf669bfe76cb36e95a5b51561..b06c28f9c32efdcef2dbefe8724c514ddaf087a5 100644
--- a/install/ui/test/data/ipa_init_objects.json
+++ b/install/ui/test/data/ipa_init_objects.json
@@ -7328,6 +7328,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 4cce2c607fc53b98857cc9c5a2b82ea96b7b11e1..f234f66a155731d68a4dcc6ac07906146c185436 100644
--- a/ipalib/plugins/internal.py
+++ b/ipalib/plugins/internal.py
@@ -627,6 +627,9 @@ class i18n_messages(Command):
                 "truststatus": _("Trust status"),
                 "trusttype": _("Trust type"),
             },
+            "trustconfig": {
+                "options": _("Options"),
+            },
             "user": {
                 "account": _("Account Settings"),
                 "account_status": _("Account Status"),
@@ -687,6 +690,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