diff --git a/install/ui/src/freeipa/host.js b/install/ui/src/freeipa/host.js index 692441f6b..5b886b639 100644 --- a/install/ui/src/freeipa/host.js +++ b/install/ui/src/freeipa/host.js @@ -112,6 +112,13 @@ return { $type: 'checkbox', acl_param: 'krbticketflags', flags: ['w_if_no_aci'] + }, + { + name: 'ipaassignedidview', + $type: 'link', + label: '@i18n:objects.idview.ipaassignedidview', + ui_formatter: 'dn', + other_entity: 'idview' } ] }, diff --git a/install/ui/src/freeipa/util.js b/install/ui/src/freeipa/util.js index 0032c8ace..adebe2cdb 100644 --- a/install/ui/src/freeipa/util.js +++ b/install/ui/src/freeipa/util.js @@ -241,6 +241,13 @@ define([ return els; } + function get_val_from_dn(dn, pos) { + if (!dn) return ''; + pos = pos === undefined ? 0 : pos; + var val = dn.split(',')[pos].split('=')[1]; + return val; + } + /** * Module with utility functions * @class @@ -362,7 +369,15 @@ define([ * @param {string} text * @return {Array} array of jQuery elements */ - beautify_message: beautify_message + beautify_message: beautify_message, + + /** + * Return value of part of DN on specified position + * @param {string} dn Distinguished name + * @param {Number} [position=0] Zero-based DN part position + * @return {string} + */ + get_val_from_dn: get_val_from_dn }; return util; diff --git a/install/ui/src/freeipa/widget.js b/install/ui/src/freeipa/widget.js index c7a082b18..b9ab82cbc 100644 --- a/install/ui/src/freeipa/widget.js +++ b/install/ui/src/freeipa/widget.js @@ -2456,6 +2456,20 @@ IPA.datetime_formatter = function(spec) { return that; }; +/** + * Format DN into single pkey + * @class + * @extends IPA.formatter + */ +IPA.dn_formatter = function(spec) { + + var that = IPA.formatter(spec); + that.format = function(value) { + return util.get_val_from_dn(value); + }; + return that; +}; + /** * Column for {@link IPA.table_widget} * @@ -6180,6 +6194,7 @@ exp.register = function() { f.register('boolean', IPA.boolean_formatter); f.register('boolean_status', IPA.boolean_status_formatter); f.register('datetime', IPA.datetime_formatter); + f.register('dn', IPA.dn_formatter); }; phases.on('registration', exp.register); diff --git a/install/ui/test/data/ipa_init.json b/install/ui/test/data/ipa_init.json index 9b6a528e4..f40ff14df 100644 --- a/install/ui/test/data/ipa_init.json +++ b/install/ui/test/data/ipa_init.json @@ -376,6 +376,7 @@ "apply_hostgroups_title": "Apply ID View ${primary_key} on hosts of ${entity}", "apply_hosts": "Apply to hosts", "apply_hosts_title": "Apply ID view ${primary_key} on ${entity}", + "ipaassignedidview": "Assigned ID View", "overrides_tab": "${primary_key} overrides:", "unapply_hostgroups": "Un-apply from host groups", "unapply_hostgroups_all_title": "Un-apply ID Views from hosts of hostgroups", diff --git a/ipalib/plugins/internal.py b/ipalib/plugins/internal.py index c58f8314a..43805daa8 100644 --- a/ipalib/plugins/internal.py +++ b/ipalib/plugins/internal.py @@ -520,6 +520,7 @@ class i18n_messages(Command): "apply_hostgroups_title": _("Apply ID View ${primary_key} on hosts of ${entity}"), "apply_hosts": _("Apply to hosts"), "apply_hosts_title": _("Apply ID view ${primary_key} on ${entity}"), + "ipaassignedidview": _("Assigned ID View"), "overrides_tab": _("${primary_key} overrides:"), "unapply_hostgroups": _("Un-apply from host groups"), "unapply_hostgroups_all_title": _("Un-apply ID Views from hosts of hostgroups"),