View | Details | Raw Unified | Return to bug 33344 | Differences between
and this patch

Collapse All | Expand All

(-)umc/js/udm/DetailPage.js (-3 / +29 lines)
 Lines 49-54    Link Here 
49
	"umc/widgets/ComboBox",
49
	"umc/widgets/ComboBox",
50
	"umc/widgets/Form",
50
	"umc/widgets/Form",
51
	"umc/widgets/Page",
51
	"umc/widgets/Page",
52
	"umc/widgets/LinkList",
52
	"umc/widgets/StandbyMixin",
53
	"umc/widgets/StandbyMixin",
53
	"umc/widgets/TabController",
54
	"umc/widgets/TabController",
54
	"dijit/layout/StackContainer",
55
	"dijit/layout/StackContainer",
 Lines 62-68    Link Here 
62
	"umc/i18n!umc/modules/udm",
63
	"umc/i18n!umc/modules/udm",
63
	"dijit/registry",
64
	"dijit/registry",
64
	"umc/widgets"
65
	"umc/widgets"
65
], 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, _ ) {
66
], 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, _ ) {
66
67
67
	var _StandbyPage = declare([Page, StandbyMixin], {});
68
	var _StandbyPage = declare([Page, StandbyMixin], {});
68
69
 Lines 443-448    Link Here 
443
			}));
444
			}));
444
		},
445
		},
445
446
447
		_renderReferencingObjectsTab: function(loadedDeferred) {
448
			var isPolicyObject = (this.objectType != 'policies/policy' && this.objectType.indexOf('policies/') === 0);
449
			when(this.ldapName, lang.hitch(this, function() {
450
				var isNewObject = !this.ldapName;
451
				if (isPolicyObject && !isNewObject) {
452
					this._referencingObjectsTab = new Page({
453
						title: _('Referencing objects'),
454
						noFooter: true,
455
						headerText: _('Objects referencing this policy object'),
456
					});
457
					this._addSubTab(this._referencingObjectsTab, 1);
458
					loadedDeferred.then(lang.hitch(this, '_createReferencingObjects'));
459
				};
460
			}));
461
		},
462
463
		_createReferencingObjects: function() {
464
			var referencingObjects = new LinkList({
465
				staticValues: this._receivedObjOrigData.$references$,
466
			});
467
			this._referencingObjectsTab.addChild(referencingObjects);
468
		},
469
446
		_renderPolicyTab: function(policies) {
470
		_renderPolicyTab: function(policies) {
447
			this._policyWidgets = {};
471
			this._policyWidgets = {};
448
			if (policies && policies.length) {
472
			if (policies && policies.length) {
 Lines 1022-1028    Link Here 
1022
			}));
1046
			}));
1023
		},
1047
		},
1024
1048
1025
		_addSubTab: function(page) {
1049
		_addSubTab: function(page, index) {
1050
			index = index || this._tabs.getChildren().length;
1026
			var tabController = new TabController({
1051
			var tabController = new TabController({
1027
				region: 'nav',
1052
				region: 'nav',
1028
				containerId: this._tabs.id,
1053
				containerId: this._tabs.id,
 Lines 1037-1043    Link Here 
1037
			page.addChild(page.position_text);
1062
			page.addChild(page.position_text);
1038
			page.own(page.position_text);
1063
			page.own(page.position_text);
1039
1064
1040
			this._tabs.addChild(page);
1065
			this._tabs.addChild(page, index);
1041
			this.own(page);
1066
			this.own(page);
1042
		},
1067
		},
1043
1068
 Lines 1118-1123    Link Here 
1118
			this._autoUpdateTabTitle(widgets);
1143
			this._autoUpdateTabTitle(widgets);
1119
			this._renderSubTabs(widgets, layout, metaInfo).then(lang.hitch(this, function() {
1144
			this._renderSubTabs(widgets, layout, metaInfo).then(lang.hitch(this, function() {
1120
				this._renderPolicyTab(policies);
1145
				this._renderPolicyTab(policies);
1146
				this._renderReferencingObjectsTab(loadedDeferred);
1121
				this._renderForm(widgets);
1147
				this._renderForm(widgets);
1122
				this._renderMultiEditCheckBoxes(widgets);
1148
				this._renderMultiEditCheckBoxes(widgets);
1123
				this._registerOptionWatchHandler();
1149
				this._registerOptionWatchHandler();
(-)umc/python/udm/__init__.py (-1 / +4 lines)
 Lines 73-79    Link Here 
73
	LDAP_Connection, set_bind_function, container_modules,
73
	LDAP_Connection, set_bind_function, container_modules,
74
	info_syntax_choices, search_syntax_choices_by_key,
74
	info_syntax_choices, search_syntax_choices_by_key,
75
	UserWithoutDN, ObjectDoesNotExist, SuperordinateDoesNotExist, NoIpLeft,
75
	UserWithoutDN, ObjectDoesNotExist, SuperordinateDoesNotExist, NoIpLeft,
76
	LDAP_AuthenticationFailed
76
	LDAP_AuthenticationFailed, policy_referencing_objects
77
)
77
)
78
from .tools import LicenseError, LicenseImport, install_opener, urlopen, dump_license, check_license
78
from .tools import LicenseError, LicenseImport, install_opener, urlopen, dump_license, check_license
79
79
 Lines 481-486    Link Here 
481
						props['$labelObjectType$'] = module.title
481
						props['$labelObjectType$'] = module.title
482
						props['$flags$'] = obj.oldattr.get('univentionObjectFlag', [])
482
						props['$flags$'] = obj.oldattr.get('univentionObjectFlag', [])
483
						props['$operations$'] = module.operations
483
						props['$operations$'] = module.operations
484
						is_policy_object = module.name.startswith('policies/') and module.name != 'policies/policy'
485
						if is_policy_object:
486
							props['$references$'] = policy_referencing_objects(ldap_dn)
484
						result.append(props)
487
						result.append(props)
485
					else:
488
					else:
486
						MODULE.process('The LDAP object for the LDAP DN %s could not be found' % ldap_dn)
489
						MODULE.process('The LDAP object for the LDAP DN %s could not be found' % ldap_dn)
(-)umc/python/udm/udm_ldap.py (-40 / +9 lines)
 Lines 55-60    Link Here 
55
from .syntax import widget, default_value
55
from .syntax import widget, default_value
56
56
57
from ldap import LDAPError, NO_SUCH_OBJECT
57
from ldap import LDAPError, NO_SUCH_OBJECT
58
from ldap import filter as ldap_filter
58
59
59
try:
60
try:
60
	import univention.admin.license
61
	import univention.admin.license
 Lines 627-647    Link Here 
627
				value = description_property.syntax.tostring(value)
628
				value = description_property.syntax.tostring(value)
628
		return value
629
		return value
629
630
630
	def is_policy_module(self):
631
		return self.name.startswith('policies/') and self.name != 'policies/policy'
632
633
	def get_layout(self, ldap_dn=None):
631
	def get_layout(self, ldap_dn=None):
634
		"""Layout information"""
632
		"""Layout information"""
635
		layout = getattr(self.module, 'layout', [])
633
		layout = getattr(self.module, 'layout', [])
636
		if ldap_dn is not None:
637
			mod = get_module(None, ldap_dn)
638
			if mod is not None and self.name == mod.name and self.is_policy_module():
639
				layout = copy.copy(layout)
640
				tab = udm_layout.Tab(_('Referencing objects'), _('Objects referencing this policy object'),
641
					layout=['_view_referencing_objects']
642
				)
643
				layout.append(tab)
644
645
		if layout and isinstance(layout[0], udm.tab):
634
		if layout and isinstance(layout[0], udm.tab):
646
			return self._parse_old_layout(layout)
635
			return self._parse_old_layout(layout)
647
636
 Lines 695-728    Link Here 
695
			if iprop['id'] in inLayout:
684
			if iprop['id'] in inLayout:
696
				properties.append(iprop)
685
				properties.append(iprop)
697
686
698
		if ldap_dn:
699
			# hack reference list for policies into items
700
			if self.is_policy_module():
701
				# create syntax object
702
				syntax = udm_syntax.LDAP_Search(
703
					filter='(&(objectClass=univentionPolicyReference)(univentionPolicyReference=%s))' % ldap_dn,
704
					viewonly=True)
705
706
				# create item
707
				item = {
708
					'id': '_view_referencing_objects',
709
					'label': '',
710
					'description': '',
711
					'syntax': syntax.name,
712
					'size': syntax.size,
713
					'required': False,
714
					'editable': False,
715
					'options': [],
716
					'readonly': False,
717
					'searchable': False,
718
					'multivalue': True,
719
					'identifies': False,
720
				}
721
722
				# read UCR configuration
723
				item.update(widget(syntax, item))
724
				properties.append(item)
725
726
		return properties
687
		return properties
727
688
728
	@property
689
	@property
 Lines 1445-1447    Link Here 
1445
		return syntax.choices
1406
		return syntax.choices
1446
1407
1447
	return map(lambda x: {'id': x[0], 'label': x[1]}, getattr(syn, 'choices', []))
1408
	return map(lambda x: {'id': x[0], 'label': x[1]}, getattr(syn, 'choices', []))
1409
1410
1411
def policy_referencing_objects(objectDN_policy):
1412
	escaped_objectDN_policy = ldap_filter.escape_filter_chars(objectDN_policy)
1413
	search_filter = "(&(objectClass=univentionPolicyReference)(univentionPolicyReference=%s))" % escaped_objectDN_policy
1414
	search_options = {"filter": search_filter, "viewonly": True}
1415
	syntax = udm_syntax.LDAP_Search(**search_options)
1416
	return read_syntax_choices(syntax)

Return to bug 33344