Univention Bugzilla – Attachment 7623 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
33344_20160426_2.patch (text/plain), 6.64 KB, created by
Jürn Brodersen
on 2016-04-26 15:32 CEST
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Jürn Brodersen
Created:
2016-04-26 15:32 CEST
Size:
6.64 KB
patch
obsolete
>Index: js/udm/ReferencingObjects.js >=================================================================== >--- js/udm/ReferencingObjects.js (nicht existent) >+++ js/udm/ReferencingObjects.js (Arbeitskopie) >@@ -0,0 +1,115 @@ >+/* >+ * Copyright 2011-2016 Univention GmbH >+ * >+ * http://www.univention.de/ >+ * >+ * All rights reserved. >+ * >+ * The source code of this program is made available >+ * under the terms of the GNU Affero General Public License version 3 >+ * (GNU AGPL V3) as published by the Free Software Foundation. >+ * >+ * Binary versions of this program provided by Univention to you as >+ * well as other copyrighted, protected or trademarked materials like >+ * Logos, graphics, fonts, specific documentations and configurations, >+ * cryptographic keys etc. are subject to a license agreement between >+ * you and Univention and not subject to the GNU AGPL V3. >+ * >+ * In the case you use this program under the terms of the GNU AGPL V3, >+ * the program is provided 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 Affero General Public License for more details. >+ * >+ * You should have received a copy of the GNU Affero General Public >+ * License with the Debian GNU/Linux or Univention distribution in file >+ * /usr/share/common-licenses/AGPL-3; if not, see >+ * <http://www.gnu.org/licenses/>. >+ */ >+/*global define console*/ >+ >+define([ >+ "dojo/_base/declare", >+ "dojo/_base/lang", >+ "dojo/_base/array", >+ "dojo/on", >+ "dojo/topic", >+ "umc/widgets/Button", >+ "umc/tools", >+ "umc/app", >+ "umc/widgets/ContainerWidget", >+], function(declare, lang, array, on, topic, Button, tools, app, ContainerWidget) { >+ return declare("umc.modules.udm.ReferencingObjects", [ ContainerWidget, ], { >+ // summary: >+ // Provides a list of buttons opening a given object >+ >+ name: '', >+ >+ value: null, >+ >+ disabled: false, >+ >+ // the widget's class name as CSS class >+ baseClass: 'umcLinkList', >+ >+ _setValueAttr: function(value) { >+ if (value instanceof Object) { >+ this._set('value', value); >+ this.destroyDescendants(); >+ array.forEach( value, lang.hitch( this, function( item ) { >+ this._addReferencingObjectLink(item); >+ })); >+ } else { >+ console.log('ReferencingObjects: not an object'); >+ }; >+ }, >+ >+ _addReferencingObjectLink: function(item) { >+ >+ // make sure that the item has all necessary properties >+ if (!array.every(['module', 'id', 'objectType'], function(ikey) { >+ if (!(ikey in item)) { >+ console.log('ReferencingObjects: attribute module is missing'); >+ return false; >+ } >+ return true; >+ })) { >+ // item has not all necessary properties -> stop here >+ return false; >+ } >+ >+ // perpare information to open the referenced UDM object >+ var moduleProps = { >+ flavor : item.flavor, >+ module : item.module, >+ openObject: { >+ objectDN : item.id, >+ objectType : item.objectType >+ } >+ }; >+ >+ // create new button >+ var btn = new Button( { >+ name : 'close', >+ label : item.label, >+ iconClass: tools.getIconClass( item.icon, 20, null, "background-size: contain" ), >+ callback: function() { >+ // open referenced UDM object >+ if (app.getModule(moduleProps.module, moduleProps.flavor)) { >+ topic.publish("/umc/modules/open", moduleProps.module, moduleProps.flavor, moduleProps); >+ } else if (app.getModule(moduleProps.module, 'navigation')) { // udm module >+ topic.publish("/umc/modules/open", moduleProps.module, 'navigation', moduleProps); >+ } else { >+ topic.publish("/umc/modules/open", moduleProps.module, moduleProps.flavor, moduleProps); >+ } >+ } >+ } ); >+ >+ this.addChild( btn ); >+ }, >+ >+ isValid: function() { >+ return true; >+ } >+ }); >+}); >Index: python/udm/__init__.py >=================================================================== >--- python/udm/__init__.py (Revision 68911) >+++ python/udm/__init__.py (Arbeitskopie) >@@ -481,6 +481,7 @@ > props['$labelObjectType$'] = module.title > props['$flags$'] = obj.oldattr.get('univentionObjectFlag', []) > props['$operations$'] = module.operations >+ props['$references$'] = module.get_references(ldap_dn) > result.append(props) > else: > MODULE.process('The LDAP object for the LDAP DN %s could not be found' % ldap_dn) >Index: python/udm/udm_ldap.py >=================================================================== >--- python/udm/udm_ldap.py (Revision 68911) >+++ 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.filter import filter_format > > try: > import univention.admin.license >@@ -638,7 +639,7 @@ > 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=['$references$'] > ) > layout.append(tab) > >@@ -695,34 +696,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 >@@ -771,6 +744,7 @@ > item.update(widget(prop.syntax, item)) > props.append(item) > props.append({'id': '$options$', 'type': 'WidgetGroup', 'widgets': self.get_options()}) >+ props.append({'id': '$references$', 'type': 'umc/modules/udm/ReferencingObjects', 'readonly': True}) > > return props > >@@ -874,6 +848,12 @@ > > return policies > >+ def get_references(self, dn): >+ if self.is_policy_module(): # TODO: move into the handlers/policies/*.py >+ search_filter = filter_format("(&(objectClass=univentionPolicyReference)(univentionPolicyReference=%s))", (dn,)) >+ return read_syntax_choices(udm_syntax.LDAP_Search(filter=search_filter, viewonly=True)) >+ return [] >+ > def types4superordinate(self, flavor, superordinate): > """List of object types for the given superordinate""" > types = getattr(self.module, 'wizardtypesforsuper')
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