Skip to content

Commit 36340d9

Browse files
committed
CLOUDSTACK-8647: UI for trust AD feature
1 parent 6572abc commit 36340d9

6 files changed

Lines changed: 134 additions & 1 deletion

File tree

client/WEB-INF/classes/resources/messages.properties

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2133,6 +2133,10 @@ label.every=Every
21332133
label.day=Day
21342134
label.of.month=of month
21352135
label.add.private.gateway=Add Private Gateway
2136+
label.link.domain.to.ldap=Link Domain to LDAP
2137+
message.link.domain.to.ldap=Enable autosync for this domain in LDAP
2138+
label.ldap.link.type=Type
2139+
label.account.type=Account Type
21362140
message.desc.created.ssh.key.pair=Created a SSH Key Pair.
21372141
message.please.confirm.remove.ssh.key.pair=Please confirm that you want to remove this SSH Key Pair
21382142
message.password.has.been.reset.to=Password has been reset to

setup/db/db/schema-452to460.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,7 @@ CREATE TABLE `cloud`.`ldap_trust_map` (
406406
`name` varchar(255) NOT NULL,
407407
`account_type` int(1) unsigned NOT NULL,
408408
PRIMARY KEY (`id`),
409-
UNIQUE KEY `uk_ldap_trust_map__domain_id` (`id`),
409+
UNIQUE KEY `uk_ldap_trust_map__domain_id` (`domain_id`),
410410
KEY `fk_ldap_trust_map__domain_id` (`domain_id`),
411411
CONSTRAINT `fk_ldap_trust_map__domain_id` FOREIGN KEY (`domain_id`) REFERENCES `domain` (`id`)
412412
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

ui/css/cloudstack3.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12851,6 +12851,14 @@ div.ui-dialog div.autoscaler div.field-group div.form-container form div.form-it
1285112851
background-position: -230px -677px;
1285212852
}
1285312853

12854+
.linktoldap .icon {
12855+
background-position: -197px -65px;
12856+
}
12857+
12858+
.linktoldap:hover .icon {
12859+
background-position: -197px -647px;
12860+
}
12861+
1285412862
.label-hovered {
1285512863
cursor: pointer;
1285612864
color: #0000FF !important;

ui/dictionary2.jsp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,6 +1066,10 @@ under the License.
10661066
'label.ovm3.vip': '<fmt:message key="label.ovm3.vip" />',
10671067
'label.local.file': '<fmt:message key="label.local.file" />',
10681068
'label.local.storage.enabled.system.vms': '<fmt:message key="label.local.storage.enabled.system.vms" />',
1069+
'label.link.domain.to.ldap': '<fmt:message key="label.link.domain.to.ldap" />',
1070+
'message.link.domain.to.ldap': '<fmt:message key="message.link.domain.to.ldap" />',
1071+
'label.ldap.link.type': '<fmt:message key="label.ldap.link.type" />',
1072+
'label.account.type': '<fmt:message key="label.account.type" />'
10691073
'label.create.ssh.key.pair': '<fmt:message key="label.create.ssh.key.pair" />',
10701074
'label.fingerprint': '<fmt:message key="label.fingerprint" />',
10711075
'label.host.tag': '<fmt:message key="label.host.tag" />',

ui/scripts/docs.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1317,5 +1317,16 @@ cloudStack.docs = {
13171317
helpOvm3Vip: {
13181318
desc: 'The VIP used by the pool and cluster',
13191319
externalLink: ''
1320+
},
1321+
helpLdapGroupName: {
1322+
desc: 'Fully qualified name of OU/GROUP in LDAP',
1323+
externalLink: ''
1324+
},
1325+
helpLdapGroupType: {
1326+
desc: 'Type of LDAP name provided. Can be either GROUP/OU',
1327+
externalLink: ''
1328+
},
1329+
helpLdapLinkDomainAdmin: {
1330+
desc: 'domain admin of the linked domain. Specify a username in GROUP/OU of LDAP'
13201331
}
13211332
};

ui/scripts/domains.js

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,109 @@
313313
}
314314
},
315315

316+
linktoldap: {
317+
label: 'label.link.domain.to.ldap',
318+
319+
action: function(args) {
320+
var data = {
321+
domainid: args.context.domains[0].id,
322+
type: args.data.type,
323+
name: args.data.name,
324+
accounttype: args.data.accounttype
325+
};
326+
327+
if (args.data.admin != null && args.data.admin.length > 0) {
328+
$.extend(data, {
329+
admin: args.data.admin
330+
});
331+
}
332+
333+
$.ajax({
334+
url: createURL('linkDomainToLdap'),
335+
data: data,
336+
success: function(json) {
337+
var item = json.linkdomaintoldapresponse.LinkDomainToLdap.domainid;
338+
args.response.success({
339+
data: item
340+
});
341+
},
342+
error: function(XMLHttpResponse) {
343+
var errorMsg = parseXMLHttpResponse(XMLHttpResponse);
344+
args.response.error(errorMsg);
345+
}
346+
});
347+
},
348+
349+
messages: {
350+
notification: function(args) {
351+
return 'label.link.domain.to.ldap';
352+
}
353+
},
354+
355+
createForm: {
356+
title: 'label.link.domain.to.ldap',
357+
desc: 'message.link.domain.to.ldap',
358+
fields: {
359+
type: {
360+
label: 'label.ldap.link.type',
361+
docID: 'helpLdapGroupType',
362+
validation: {
363+
required: true
364+
},
365+
select: function(args) {
366+
var items = [];
367+
items.push({
368+
id: "GROUP",
369+
description: "GROUP"
370+
}); //regular-user
371+
items.push({
372+
id: "OU",
373+
description: "OU"
374+
}); //root-admin
375+
args.response.success({
376+
data: items
377+
});
378+
}
379+
},
380+
name: {
381+
label: 'label.name',
382+
docID: 'helpLdapGroupName',
383+
validation: {
384+
required: true
385+
}
386+
},
387+
accounttype: {
388+
label: 'label.account.type',
389+
docID: 'helpAccountType',
390+
validation: {
391+
required: true
392+
},
393+
select: function(args) {
394+
var items = [];
395+
items.push({
396+
id: 0,
397+
description: "Normal User"
398+
}); //regular-user
399+
items.push({
400+
id: 2,
401+
description: "Domain Admin"
402+
}); //root-admin
403+
args.response.success({
404+
data: items
405+
});
406+
}
407+
},
408+
admin: {
409+
label: 'label.domain.admin',
410+
docID: 'helpLdapLinkDomainAdmin',
411+
validation: {
412+
required: false
413+
}
414+
}
415+
}
416+
}
417+
},
418+
316419
updateResourceCount: {
317420
label: 'label.action.update.resource.count',
318421
messages: {
@@ -652,6 +755,9 @@
652755
if (jsonObj.level != 0) { //ROOT domain (whose level is 0) is not allowed to delete
653756
allowedActions.push("delete");
654757
}
758+
if(isLdapEnabled()) {
759+
allowedActions.push("linktoldap")
760+
}
655761
} else if (isDomainAdmin()) {
656762
if (args.context.domains[0].id != g_domainid) {
657763
allowedActions.push("edit"); //merge updateResourceLimit into edit

0 commit comments

Comments
 (0)