summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAna Krivokapic <akrivoka@redhat.com>2013-03-07 14:12:49 +0100
committerPetr Vobornik <pvoborni@redhat.com>2013-03-18 15:11:26 +0100
commit6c85b88874d099a909c5662a6a32c045439e0b2c (patch)
tree07bae15908c943f9ef4b352b8b29dd14b308f3b9
parent8d369519116cb1f257304d79d13e63188fc7d978 (diff)
downloadfreeipa-6c85b88874d099a909c5662a6a32c045439e0b2c.tar.gz
freeipa-6c85b88874d099a909c5662a6a32c045439e0b2c.tar.xz
freeipa-6c85b88874d099a909c5662a6a32c045439e0b2c.zip
Realm Domains page
Add support for Realm Domains to web UI. https://fedorahosted.org/freeipa/ticket/3407
-rw-r--r--install/ui/src/freeipa/app.js1
-rw-r--r--install/ui/src/freeipa/realmdomains.js103
-rw-r--r--install/ui/src/freeipa/webui.js5
-rw-r--r--install/ui/test/data/ipa_init.json6
-rw-r--r--install/ui/test/data/ipa_init_objects.json42
-rw-r--r--install/ui/test/data/realmdomains_show.json24
-rw-r--r--ipalib/plugins/internal.py6
-rw-r--r--ipalib/plugins/realmdomains.py7
-rw-r--r--tests/test_xmlrpc/test_realmdomains_plugin.py3
9 files changed, 190 insertions, 7 deletions
diff --git a/install/ui/src/freeipa/app.js b/install/ui/src/freeipa/app.js
index 9d89c1ae..3dcb10f4 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 00000000..ea3997a1
--- /dev/null
+++ b/install/ui/src/freeipa/realmdomains.js
@@ -0,0 +1,103 @@
+/* Authors:
+ * Ana Krivokapic <akrivoka@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', './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) {
+ spec = spec || {};
+ var that = IPA.details_facet(spec);
+
+ 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) {
+ that.update_on_error(xhr, text_status, error_thrown);
+ if (on_error) on_error.call(this, xhr, text_status, error_thrown);
+ };
+
+ var dialog = IPA.confirm_dialog({
+ title: IPA.messages.objects.realmdomains.check_dns,
+ message: IPA.messages.objects.realmdomains.check_dns_confirmation,
+ ok_label: IPA.messages.objects.realmdomains.check_dns,
+ on_ok: function () {
+ command.execute();
+ }
+ });
+
+ var cancel_button = dialog.get_button('cancel');
+ dialog.buttons.remove('cancel');
+
+ dialog.create_button({
+ name: 'force',
+ label: IPA.messages.objects.realmdomains.force_update,
+ visible: true,
+ click: function () {
+ command.set_option('force', true);
+ command.execute();
+ dialog.close();
+ }
+ });
+
+ dialog.add_button(cancel_button);
+ dialog.open();
+ };
+
+ 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 2bc3bdd4..5315f3ac 100644
--- a/install/ui/src/freeipa/webui.js
+++ b/install/ui/src/freeipa/webui.js
@@ -43,7 +43,8 @@ IPA.admin_navigation = function(spec) {
{entity: 'dnsrecord', hidden:true}
]
},
- {entity: 'cert', label: IPA.messages.tabs.cert }
+ {entity: 'cert', label: IPA.messages.tabs.cert },
+ {entity: 'realmdomains'}
]},
{name: 'policy', label: IPA.messages.tabs.policy, children: [
{name: 'hbac', label: IPA.messages.tabs.hbac, children: [
@@ -127,4 +128,4 @@ IPA.self_serv_navigation = function(spec) {
};
return {};
-}); \ No newline at end of file
+});
diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json
index e4d9c2a9..e563c0e5 100644
--- a/install/ui/test/data/ipa_init.json
+++ b/install/ui/test/data/ipa_init.json
@@ -398,6 +398,12 @@
"type_ad": "Active Directory domain",
"type_local": "Local domain"
},
+ "realmdomains": {
+ "identity": "Realm Domains",
+ "check_dns": "Check DNS",
+ "check_dns_confirmation": "Do you also want to perform DNS check?",
+ "force_update": "Force Update"
+ },
"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 6458e4cd..0243c63d 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 00000000..84254ba4
--- /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 ad15b5c4..85bf7d21 100644
--- a/ipalib/plugins/internal.py
+++ b/ipalib/plugins/internal.py
@@ -536,6 +536,12 @@ class i18n_messages(Command):
"type_ad": _("Active Directory domain"),
"type_local": _("Local domain"),
},
+ "realmdomains": {
+ "identity": _("Realm Domains"),
+ "check_dns": _("Check DNS"),
+ "check_dns_confirmation": _("Do you also want to perform DNS check?"),
+ "force_update": _("Force Update"),
+ },
"role": {
"identity": _("Role Settings"),
},
diff --git a/ipalib/plugins/realmdomains.py b/ipalib/plugins/realmdomains.py
index 99ab8798..f3dbf8da 100644
--- a/ipalib/plugins/realmdomains.py
+++ b/ipalib/plugins/realmdomains.py
@@ -105,9 +105,10 @@ class realmdomains_mod(LDAPUpdate):
if get_domain_name() not in associateddomain:
raise errors.ValidationError(name='domain', error=_("cannot delete domain of IPA server"))
if not force:
- for d in associateddomain:
- if not has_soa_or_ns_record(d):
- raise errors.ValidationError(name='domain', error=_("no SOA or NS records found for domain %s" % d))
+ bad_domains = [d for d in associateddomain if not has_soa_or_ns_record(d)]
+ if bad_domains:
+ bad_domains = ', '.join(bad_domains)
+ raise errors.ValidationError(name='domain', error=_("no SOA or NS records found for domains: %s" % bad_domains))
return dn
# If --add-domain or --del-domain options were provided, read
diff --git a/tests/test_xmlrpc/test_realmdomains_plugin.py b/tests/test_xmlrpc/test_realmdomains_plugin.py
index 539643b0..22cac228 100644
--- a/tests/test_xmlrpc/test_realmdomains_plugin.py
+++ b/tests/test_xmlrpc/test_realmdomains_plugin.py
@@ -20,7 +20,6 @@
Test the `ipalib/plugins/realmdomains.py` module.
"""
-import random, string
from ipalib import api, errors
from ipapython.dn import DN
from tests.test_xmlrpc import objectclasses
@@ -131,7 +130,7 @@ class test_realmdomains(Declarative):
desc='Try to replace list of realm domains with a list with an invalid domain "%s"' % bad_domain,
command=('realmdomains_mod', [], {'associateddomain': [our_domain, bad_domain]}),
expected=errors.ValidationError(
- name='domain', error='no SOA or NS records found for domain %s' % bad_domain),
+ name='domain', error='no SOA or NS records found for domains: %s' % bad_domain),
),
dict(
desc='Try to add an invalid domain "%s"' % bad_domain,