Univention Bugzilla – Attachment 7606 Details for
Bug 33344
wrong referenced policy is displayed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
proposed patch 3 (use of udm/get)
33344_3-code.patch (text/plain), 6.47 KB, created by
Jürn Brodersen
on 2016-04-20 17:53 CEST
(
hide
)
Description:
proposed patch 3 (use of udm/get)
Filename:
MIME Type:
Creator:
Jürn Brodersen
Created:
2016-04-20 17:53 CEST
Size:
6.47 KB
patch
obsolete
>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,29 @@ > })); > }, > >+ _renderReferencingObjectsTab: function(loadedDeferred) { >+ var isPolicyObject = (this.objectType != 'policies/policy' && this.objectType.indexOf('policies/') === 0); >+ when(this.ldapName, lang.hitch(this, function() { >+ var isNewObject = !this.ldapName; >+ if (isPolicyObject && !isNewObject) { >+ this._referencingObjectsTab = new Page({ >+ title: _('Referencing objects'), >+ noFooter: true, >+ headerText: _('Objects referencing this policy object'), >+ }); >+ this._addSubTab(this._referencingObjectsTab, 1); >+ loadedDeferred.then(lang.hitch(this, '_createReferencingObjects')); >+ }; >+ })); >+ }, >+ >+ _createReferencingObjects: function() { >+ var referencingObjects = new LinkList({ >+ staticValues: this._receivedObjOrigData.$references$, >+ }); >+ this._referencingObjectsTab.addChild(referencingObjects); >+ }, >+ > _renderPolicyTab: function(policies) { > this._policyWidgets = {}; > if (policies && policies.length) { >@@ -1022,7 +1046,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 +1062,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 +1143,7 @@ > this._autoUpdateTabTitle(widgets); > this._renderSubTabs(widgets, layout, metaInfo).then(lang.hitch(this, function() { > this._renderPolicyTab(policies); >+ this._renderReferencingObjectsTab(loadedDeferred); > 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) >@@ -73,7 +73,7 @@ > LDAP_Connection, set_bind_function, container_modules, > info_syntax_choices, search_syntax_choices_by_key, > UserWithoutDN, ObjectDoesNotExist, SuperordinateDoesNotExist, NoIpLeft, >- LDAP_AuthenticationFailed >+ LDAP_AuthenticationFailed, policy_referencing_objects > ) > from .tools import LicenseError, LicenseImport, install_opener, urlopen, dump_license, check_license > >@@ -481,6 +481,9 @@ > props['$labelObjectType$'] = module.title > props['$flags$'] = obj.oldattr.get('univentionObjectFlag', []) > props['$operations$'] = module.operations >+ is_policy_object = module.name.startswith('policies/') and module.name != 'policies/policy' >+ if is_policy_object: >+ props['$references$'] = policy_referencing_objects(ldap_dn) > result.append(props) > else: > MODULE.process('The LDAP object for the LDAP DN %s could not be found' % ldap_dn) >Index: umc/python/udm/udm_ldap.py >=================================================================== >--- umc/python/udm/udm_ldap.py (Revision 68436) >+++ umc/python/udm/udm_ldap.py (Arbeitskopie) >@@ -55,6 +55,7 @@ > from .syntax import widget, default_value > > from ldap import LDAPError, NO_SUCH_OBJECT >+from ldap import filter as ldap_filter > > try: > import univention.admin.license >@@ -627,21 +628,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 +684,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 >@@ -1445,3 +1406,11 @@ > return syntax.choices > > return map(lambda x: {'id': x[0], 'label': x[1]}, getattr(syn, 'choices', [])) >+ >+ >+def policy_referencing_objects(objectDN_policy): >+ escaped_objectDN_policy = ldap_filter.escape_filter_chars(objectDN_policy) >+ search_filter = "(&(objectClass=univentionPolicyReference)(univentionPolicyReference=%s))" % escaped_objectDN_policy >+ search_options = {"filter": search_filter, "viewonly": True} >+ syntax = udm_syntax.LDAP_Search(**search_options) >+ return read_syntax_choices(syntax)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
Actions:
View
|
Diff
Attachments on
bug 33344
:
7582
|
7587
|
7588
|
7606
|
7608
|
7619
|
7623