On 02/27/2013 05:10 PM, Petr Vobornik wrote:
> On 02/27/2013 04:20 PM, Ana Krivokapic wrote:
>> Add support for Realm Domains to web UI.
>>
>> https://fedorahosted.org/freeipa/ticket/3407
>
> The patch looks good, but there is a issue we don't have a precedence
> for.
>
> The mod command is doing dns check for new domains. Currently we can't
> specify --force option to bypass the check.
>
> I see two possible implementations:
> 1) On update, when user adds or modifies the values, a dialog would
> pop up and ask user whether he wants to force it.
>
> 2) Another option is to disable edit on the list(deletion would be
> still allowed) and move the add operation to separate action in action
> list.
>
> I prefer the former. Latter might have issues with two modifications
> (delete and add) at the same time at two different places (facet and
> add dialog).

Added force option to the error dialog.

Updated patch is attached.

-- 
Regards,

Ana Krivokapic
Associate Software Engineer
FreeIPA team
Red Hat Inc.

From fb6feb8a3a8639a495c5827f8a514f775aa4f7a6 Mon Sep 17 00:00:00 2001
From: Ana Krivokapic <akriv...@redhat.com>
Date: Tue, 5 Mar 2013 16:40:50 +0100
Subject: [PATCH] Realm Domains page

Add support for Realm Domains to web UI.

https://fedorahosted.org/freeipa/ticket/3407
---
 install/ui/src/freeipa/app.js               |   1 +
 install/ui/src/freeipa/realmdomains.js      | 102 ++++++++++++++++++++++++++++
 install/ui/src/freeipa/webui.js             |   3 +-
 install/ui/test/data/ipa_init.json          |   3 +
 install/ui/test/data/ipa_init_objects.json  |  42 ++++++++++++
 install/ui/test/data/realmdomains_show.json |  24 +++++++
 ipalib/plugins/internal.py                  |   3 +
 7 files changed, 177 insertions(+), 1 deletion(-)
 create mode 100644 install/ui/src/freeipa/realmdomains.js
 create mode 100644 install/ui/test/data/realmdomains_show.json

diff --git a/install/ui/src/freeipa/app.js b/install/ui/src/freeipa/app.js
index 9d89c1aede857ddfc27ebffa306c41172ed56bca..3dcb10f493824923254636c06b715164e419cce5 100644
--- a/install/ui/src/freeipa/app.js
+++ b/install/ui/src/freeipa/app.js
@@ -41,6 +41,7 @@ define([
     './idrange',
     './netgroup',
     './policy',
+    './realmdomains',
     './rule',
     './selinux',
     './serverconfig',
diff --git a/install/ui/src/freeipa/realmdomains.js b/install/ui/src/freeipa/realmdomains.js
new file mode 100644
index 0000000000000000000000000000000000000000..16ef491cd68422772063b3a9e4268e3b580bd8e9
--- /dev/null
+++ b/install/ui/src/freeipa/realmdomains.js
@@ -0,0 +1,102 @@
+/*  Authors:
+ *    Ana Krivokapic <akriv...@redhat.com>
+ *
+ * Copyright (C) 2013 Red Hat
+ * see file 'COPYING' for use and warranty information
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+define(['./ipa', './jquery', './details', './search', './association',
+    './entity'], function (IPA, $) {
+
+    IPA.realmdomains = {};
+
+    IPA.realmdomains.entity = function (spec) {
+
+        var that = IPA.entity(spec);
+
+        that.init = function () {
+            that.entity_init();
+
+            that.builder.details_facet({
+                factory: IPA.realmdomains_details_facet,
+                title: IPA.metadata.objects.realmdomains.label,
+                sections: [
+                    {
+                        name: 'identity',
+                        label: IPA.messages.objects.realmdomains.identity,
+                        fields: [
+                            {
+                                name: 'associateddomain',
+                                type: 'multivalued'
+                            }
+                        ]
+                    }
+                ],
+                needs_update: true
+            });
+        };
+        return that;
+    };
+
+    IPA.realmdomains_details_facet = function (spec, no_init) {
+        spec = spec || {};
+        var that = IPA.details_facet(spec, true);
+
+        that.update = function (on_success, on_error) {
+            var command = that.create_update_command();
+
+            command.on_success = function (data, text_status, xhr) {
+                that.update_on_success(data, text_status, xhr);
+                if (on_success) on_success.call(this, data, text_status, xhr);
+            };
+
+            command.on_error = function (xhr, text_status, error_thrown) {
+                var dialog = IPA.error_dialog({
+                    xhr: xhr,
+                    text_status: text_status,
+                    error_thrown: error_thrown,
+                    command: command
+                });
+
+                dialog.create_button({
+                    name: 'force',
+                    label: 'Force',
+                    visible: true,
+                    click: function () {
+                        command.set_option('force', true);
+                        command.execute();
+                        dialog.close();
+                    }
+                });
+
+                dialog.open();
+
+                that.update_on_error(xhr, text_status, error_thrown);
+                if (on_error) on_error.call(this, xhr, text_status, error_thrown);
+            };
+
+            command.retry = false;
+            command.execute();
+        };
+
+        if (!no_init) that.init_details_facet();
+        return that;
+    };
+
+    IPA.register('realmdomains', IPA.realmdomains.entity);
+
+    return {};
+});
diff --git a/install/ui/src/freeipa/webui.js b/install/ui/src/freeipa/webui.js
index f6c3339ec4b5d3fb8a4cb547407eebf2a19b45af..04b255d8e99f59a777fce6eea230d01b48f52a9f 100644
--- a/install/ui/src/freeipa/webui.js
+++ b/install/ui/src/freeipa/webui.js
@@ -42,7 +42,8 @@ IPA.admin_navigation = function(spec) {
                  {entity: 'dnsconfig'},
                  {entity: 'dnsrecord', hidden:true}
              ]
-            }
+            },
+            {entity: 'realmdomains'}
         ]},
         {name: 'policy', label: IPA.messages.tabs.policy, children: [
             {name: 'hbac', label: IPA.messages.tabs.hbac, children: [
diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json
index c16bc992e437e6a5e1be918d46ea5dda33b97562..84663c9cb6c996ba9cf9428548a0cc860fdcd323 100644
--- a/install/ui/test/data/ipa_init.json
+++ b/install/ui/test/data/ipa_init.json
@@ -380,6 +380,9 @@
                             "type_ad": "Active Directory domain",
                             "type_local": "Local domain"
                         },
+                        "realmdomains": {
+                            "identity": "Realm Domains"
+                        },
                         "role": {
                             "identity": "Role Settings"
                         },
diff --git a/install/ui/test/data/ipa_init_objects.json b/install/ui/test/data/ipa_init_objects.json
index 6458e4cdaa5c64ee0bd82df67508b002bc4446fb..0243c63d402f7de304322117e577f8a06e431d3f 100644
--- a/install/ui/test/data/ipa_init_objects.json
+++ b/install/ui/test/data/ipa_init_objects.json
@@ -6026,6 +6026,48 @@
                 ],
                 "uuid_attribute": ""
             },
+            "realmdomains": {
+                "aciattrs": [],
+                "attribute_members": {},
+                "bindable": false,
+                "container_dn": "",
+                "default_attributes": ["associateddomain"],
+                "hidden_attributes": [
+                    "objectclass",
+                    "aci"
+                ],
+                "label": "Realm Domains",
+                "label_singular": "Realm Domains",
+                "methods": [
+                    "mod",
+                    "show"
+                ],
+                "name": "realmdomains",
+                "object_class": [
+                    "domainrelatedobject",
+                    "top",
+                    "nscontainter"
+                ],
+                "object_class_config": null,
+                "object_name": "realmdomains",
+                "object_name_plural": "realmdomains",
+                "parent_object": "",
+                "rdn_attribute": "",
+                "relationships": {},
+                "takes_params": [
+                    {
+                        "class": "Str",
+                        "doc": "Domain",
+                        "flags": [],
+                        "label": "Domain",
+                        "name": "associateddomain",
+                        "required": true,
+                        "type": "unicode",
+                        "multivalued": true
+                    }
+                ],
+                "uuid_attribute": ""
+            },
             "role": {
                 "aciattrs": [
                     "businesscategory",
diff --git a/install/ui/test/data/realmdomains_show.json b/install/ui/test/data/realmdomains_show.json
new file mode 100644
index 0000000000000000000000000000000000000000..84254ba4524c0498d7e02f628d29d14c6ca6aa97
--- /dev/null
+++ b/install/ui/test/data/realmdomains_show.json
@@ -0,0 +1,24 @@
+{
+    "error": null,
+    "id": 0,
+    "result": {
+        "result": {
+            "attributelevelrights": {
+                "aci": "rscwo",
+                "cn": "rscwo",
+                "associateddomain": "rscwo",
+                "objectclass": "rscwo"
+            },
+            "cn": ["Realm Domains"],
+            "dn": "cn=Realm Domains,cn=ipa,cn=etc,dc=example,dc=com",
+            "associateddomain": ["example.com"],
+            "objectclass": [
+                "nsContainer",
+                "top",
+                "domainRelatedObject"
+            ]
+        },
+        "summary": null,
+        "value": ""
+    }
+}
diff --git a/ipalib/plugins/internal.py b/ipalib/plugins/internal.py
index 42bece6013bafe54e67c719a2e3ba358a0292fd4..c1a8f4a74b9b85fb7d0653f2dc4ff65ea2ee65bf 100644
--- a/ipalib/plugins/internal.py
+++ b/ipalib/plugins/internal.py
@@ -518,6 +518,9 @@ class i18n_messages(Command):
                 "type_ad": _("Active Directory domain"),
                 "type_local": _("Local domain"),
             },
+            "realmdomains": {
+                "identity": _("Realm Domains"),
+            },
             "role": {
                 "identity": _("Role Settings"),
             },
-- 
1.7.11.7

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

Reply via email to