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

Collapse All | Expand All

(-)umc/js/udm/DetailPage.js (-3 / +28 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() {
448
			if (this.objectType != 'policies/policy' && this.objectType.indexOf('policies/') === 0) {
449
				this._referencingObjectsTab = new Page({
450
					title: _('Referencing objects'),
451
					noFooter: true,
452
					headerText: _('Objects referencing this policy object'),
453
				});
454
				this._addSubTab(this._referencingObjectsTab, 1);
455
				when(this.ldapName, lang.hitch(this, '_createReferencingObjects'));
456
			};
457
		},
458
459
		_createReferencingObjects: function(ldapName) {
460
			var referencingObjects = new LinkList({
461
				dynamicValues: "udm/policy/referencing_objects",
462
				dynamicOptions: {
463
					objectDN_policy: ldapName,
464
				},
465
			});
466
			this._referencingObjectsTab.addChild(referencingObjects);
467
		},
468
446
		_renderPolicyTab: function(policies) {
469
		_renderPolicyTab: function(policies) {
447
			this._policyWidgets = {};
470
			this._policyWidgets = {};
448
			if (policies && policies.length) {
471
			if (policies && policies.length) {
 Lines 1022-1028    Link Here 
1022
			}));
1045
			}));
1023
		},
1046
		},
1024
1047
1025
		_addSubTab: function(page) {
1048
		_addSubTab: function(page, index) {
1049
			index = index || this._tabs.getChildren().length;
1026
			var tabController = new TabController({
1050
			var tabController = new TabController({
1027
				region: 'nav',
1051
				region: 'nav',
1028
				containerId: this._tabs.id,
1052
				containerId: this._tabs.id,
 Lines 1037-1043    Link Here 
1037
			page.addChild(page.position_text);
1061
			page.addChild(page.position_text);
1038
			page.own(page.position_text);
1062
			page.own(page.position_text);
1039
1063
1040
			this._tabs.addChild(page);
1064
			this._tabs.addChild(page, index);
1041
			this.own(page);
1065
			this.own(page);
1042
		},
1066
		},
1043
1067
 Lines 1118-1123    Link Here 
1118
			this._autoUpdateTabTitle(widgets);
1142
			this._autoUpdateTabTitle(widgets);
1119
			this._renderSubTabs(widgets, layout, metaInfo).then(lang.hitch(this, function() {
1143
			this._renderSubTabs(widgets, layout, metaInfo).then(lang.hitch(this, function() {
1120
				this._renderPolicyTab(policies);
1144
				this._renderPolicyTab(policies);
1145
				this._renderReferencingObjectsTab();
1121
				this._renderForm(widgets);
1146
				this._renderForm(widgets);
1122
				this._renderMultiEditCheckBoxes(widgets);
1147
				this._renderMultiEditCheckBoxes(widgets);
1123
				this._registerOptionWatchHandler();
1148
				this._registerOptionWatchHandler();
(-)umc/python/udm/__init__.py (+11 lines)
 Lines 60-65    Link Here 
60
import univention.admin.modules as udm_modules
60
import univention.admin.modules as udm_modules
61
import univention.admin.objects as udm_objects
61
import univention.admin.objects as udm_objects
62
import univention.admin.uexceptions as udm_errors
62
import univention.admin.uexceptions as udm_errors
63
import univention.admin.syntax as udm_syntax
63
64
64
from univention.config_registry import handler_set
65
from univention.config_registry import handler_set
65
66
 Lines 851-856    Link Here 
851
		module = self._get_module_by_request(request)
852
		module = self._get_module_by_request(request)
852
		return module.policies
853
		return module.policies
853
854
855
	@sanitize(
856
		objectDN_policy=LDAPSearchSanitizer(use_asterisks=False)
857
	)
858
	@simple_response
859
	def policy_referencing_objects(self, objectDN_policy):
860
		search_filter = "(&(objectClass=univentionPolicyReference)(univentionPolicyReference=%s))" % objectDN_policy
861
		search_options = {"filter": search_filter, "viewonly": True}
862
		syntax = udm_syntax.LDAP_Search(**search_options)
863
		return read_syntax_choices(syntax)
864
854
	def validate(self, request):
865
	def validate(self, request):
855
		"""Validates the correctness of values for properties of the
866
		"""Validates the correctness of values for properties of the
856
		given object type. Therefor the syntax definition of the properties is used.
867
		given object type. Therefor the syntax definition of the properties is used.
(-)umc/python/udm/udm_ldap.py (-40 lines)
 Lines 627-647    Link Here 
627
				value = description_property.syntax.tostring(value)
627
				value = description_property.syntax.tostring(value)
628
		return value
628
		return value
629
629
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):
630
	def get_layout(self, ldap_dn=None):
634
		"""Layout information"""
631
		"""Layout information"""
635
		layout = getattr(self.module, 'layout', [])
632
		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):
633
		if layout and isinstance(layout[0], udm.tab):
646
			return self._parse_old_layout(layout)
634
			return self._parse_old_layout(layout)
647
635
 Lines 695-728    Link Here 
695
			if iprop['id'] in inLayout:
683
			if iprop['id'] in inLayout:
696
				properties.append(iprop)
684
				properties.append(iprop)
697
685
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
686
		return properties
727
687
728
	@property
688
	@property
(-)umc/udm.xml (+1 lines)
 Lines 104-109    Link Here 
104
		<command name="udm/values" function="values" />
104
		<command name="udm/values" function="values" />
105
		<command name="udm/templates" function="templates" />
105
		<command name="udm/templates" function="templates" />
106
		<command name="udm/policies" function="policies" />
106
		<command name="udm/policies" function="policies" />
107
		<command name="udm/policy/referencing_objects" function="policy_referencing_objects" />
107
		<command name="udm/put" function="put" />
108
		<command name="udm/put" function="put" />
108
		<command name="udm/add" function="add" />
109
		<command name="udm/add" function="add" />
109
		<command name="udm/remove" function="remove" />
110
		<command name="udm/remove" function="remove" />

Return to bug 33344