Index: umc/js/udm/DetailPage.js =================================================================== --- umc/js/udm/DetailPage.js (Revision 68436) +++ umc/js/udm/DetailPage.js (Arbeitskopie) @@ -49,6 +49,7 @@ "umc/widgets/ComboBox", "umc/widgets/Form", "umc/widgets/Page", + "umc/widgets/LinkList", "umc/widgets/StandbyMixin", "umc/widgets/TabController", "dijit/layout/StackContainer", @@ -62,7 +63,7 @@ "umc/i18n!umc/modules/udm", "dijit/registry", "umc/widgets" -], function(declare, lang, array, on, Deferred, all, when, construct, domClass, topic, json, TitlePane, render, tools, dialog, ContainerWidget, MultiInput, ComboBox, Form, Page, StandbyMixin, TabController, StackContainer, Text, Button, LabelPane, Template, OverwriteLabel, UMCPBundle, cache, _ ) { +], function(declare, lang, array, on, Deferred, all, when, construct, domClass, topic, json, TitlePane, render, tools, dialog, ContainerWidget, MultiInput, ComboBox, Form, Page, LinkList, StandbyMixin, TabController, StackContainer, Text, Button, LabelPane, Template, OverwriteLabel, UMCPBundle, cache, _ ) { var _StandbyPage = declare([Page, StandbyMixin], {}); @@ -443,6 +444,28 @@ })); }, + _renderReferencingObjectsTab: function() { + if (this.objectType != 'policies/policy' && this.objectType.indexOf('policies/') === 0) { + this._referencingObjectsTab = new Page({ + title: _('Referencing objects'), + noFooter: true, + headerText: _('Objects referencing this policy object'), + }); + this._addSubTab(this._referencingObjectsTab, 1); + when(this.ldapName, lang.hitch(this, '_createReferencingObjects')); + }; + }, + + _createReferencingObjects: function(ldapName) { + var referencingObjects = new LinkList({ + dynamicValues: "udm/policy/referencing_objects", + dynamicOptions: { + objectDN_policy: ldapName, + }, + }); + this._referencingObjectsTab.addChild(referencingObjects); + }, + _renderPolicyTab: function(policies) { this._policyWidgets = {}; if (policies && policies.length) { @@ -1022,7 +1045,8 @@ })); }, - _addSubTab: function(page) { + _addSubTab: function(page, index) { + index = index || this._tabs.getChildren().length; var tabController = new TabController({ region: 'nav', containerId: this._tabs.id, @@ -1037,7 +1061,7 @@ page.addChild(page.position_text); page.own(page.position_text); - this._tabs.addChild(page); + this._tabs.addChild(page, index); this.own(page); }, @@ -1118,6 +1142,7 @@ this._autoUpdateTabTitle(widgets); this._renderSubTabs(widgets, layout, metaInfo).then(lang.hitch(this, function() { this._renderPolicyTab(policies); + this._renderReferencingObjectsTab(); this._renderForm(widgets); this._renderMultiEditCheckBoxes(widgets); this._registerOptionWatchHandler(); Index: umc/python/udm/__init__.py =================================================================== --- umc/python/udm/__init__.py (Revision 68436) +++ umc/python/udm/__init__.py (Arbeitskopie) @@ -60,6 +60,7 @@ import univention.admin.modules as udm_modules import univention.admin.objects as udm_objects import univention.admin.uexceptions as udm_errors +import univention.admin.syntax as udm_syntax from univention.config_registry import handler_set @@ -851,6 +852,16 @@ module = self._get_module_by_request(request) return module.policies + @sanitize( + objectDN_policy=LDAPSearchSanitizer(use_asterisks=False) + ) + @simple_response + def policy_referencing_objects(self, objectDN_policy): + search_filter = "(&(objectClass=univentionPolicyReference)(univentionPolicyReference=%s))" % objectDN_policy + search_options = {"filter": search_filter, "viewonly": True} + syntax = udm_syntax.LDAP_Search(**search_options) + return read_syntax_choices(syntax) + def validate(self, request): """Validates the correctness of values for properties of the given object type. Therefor the syntax definition of the properties is used. Index: umc/python/udm/udm_ldap.py =================================================================== --- umc/python/udm/udm_ldap.py (Revision 68436) +++ umc/python/udm/udm_ldap.py (Arbeitskopie) @@ -627,21 +627,9 @@ value = description_property.syntax.tostring(value) return value - def is_policy_module(self): - return self.name.startswith('policies/') and self.name != 'policies/policy' - def get_layout(self, ldap_dn=None): """Layout information""" layout = getattr(self.module, 'layout', []) - if ldap_dn is not None: - mod = get_module(None, ldap_dn) - if mod is not None and self.name == mod.name and self.is_policy_module(): - layout = copy.copy(layout) - tab = udm_layout.Tab(_('Referencing objects'), _('Objects referencing this policy object'), - layout=['_view_referencing_objects'] - ) - layout.append(tab) - if layout and isinstance(layout[0], udm.tab): return self._parse_old_layout(layout) @@ -695,34 +683,6 @@ if iprop['id'] in inLayout: properties.append(iprop) - if ldap_dn: - # hack reference list for policies into items - if self.is_policy_module(): - # create syntax object - syntax = udm_syntax.LDAP_Search( - filter='(&(objectClass=univentionPolicyReference)(univentionPolicyReference=%s))' % ldap_dn, - viewonly=True) - - # create item - item = { - 'id': '_view_referencing_objects', - 'label': '', - 'description': '', - 'syntax': syntax.name, - 'size': syntax.size, - 'required': False, - 'editable': False, - 'options': [], - 'readonly': False, - 'searchable': False, - 'multivalue': True, - 'identifies': False, - } - - # read UCR configuration - item.update(widget(syntax, item)) - properties.append(item) - return properties @property Index: umc/udm.xml =================================================================== --- umc/udm.xml (Revision 68436) +++ umc/udm.xml (Arbeitskopie) @@ -104,6 +104,7 @@ +