Skip to content

Commit 89945cd

Browse files
author
Jessica Wang
committed
CLOUDSTACK-5527: UI > accounts page > support both "Add (non-LDAP) Account" and "Add LDAP Account" when LDAP is enabled.
1 parent 3c68b9f commit 89945cd

3 files changed

Lines changed: 42 additions & 6 deletions

File tree

‎ui/scripts/accounts.js‎

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,44 @@
8686

8787
action: {
8888
custom: cloudStack.uiCustom.accountsWizard(
89-
cloudStack.accountsWizard
89+
cloudStack.accountsWizard,
90+
false
9091
)
9192
}
9293

93-
}
94+
},
95+
96+
addLdapAccount: {
97+
label: 'Add LDAP Account',
98+
isHeader: true,
99+
preFilter: function(args) {
100+
if ((isAdmin() || isDomainAdmin()) && isLdapEnabled()) {
101+
return true;
102+
} else {
103+
return false;
104+
}
105+
},
106+
messages: {
107+
notification: function(args) {
108+
return 'Add LDAP Account';
109+
}
110+
},
111+
notification: {
112+
poll: function(args) {
113+
args.complete({
114+
actionFilter: accountActionfilter
115+
});
116+
}
117+
},
118+
119+
action: {
120+
custom: cloudStack.uiCustom.accountsWizard(
121+
cloudStack.accountsWizard,
122+
true
123+
)
124+
}
125+
126+
}
94127
},
95128

96129
dataProvider: function(args) {

‎ui/scripts/accountsWizard.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@
174174

175175
action: function(args) {
176176
var array1 = [];
177-
var ldapStatus = isLdapEnabled();
177+
var ldapStatus = args.isLdap;
178178
if (args.username) {
179179
array1.push("&username=" + args.username);
180180
}

‎ui/scripts/ui-custom/accountsWizard.js‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@
1616
// under the License.
1717

1818
(function($, cloudStack) {
19-
cloudStack.uiCustom.accountsWizard = function(args) {
19+
cloudStack.uiCustom.accountsWizard = function(args, isLdap) {
2020
return function(listViewArgs) {
2121
var context = listViewArgs.context;
22-
var ldapStatus = isLdapEnabled();
22+
var ldapStatus = isLdap;
2323
var accountsWizard = function(data) {
2424
var $wizard = $('#template').find('div.accounts-wizard').clone();
2525
var $form = $wizard.find('form');
@@ -39,6 +39,7 @@
3939
args.action({
4040
context: context,
4141
data: data,
42+
isLdap: isLdap,
4243
groupname: groupname,
4344
response: {
4445
error: function(message) {
@@ -58,6 +59,7 @@
5859
args.action({
5960
context: context,
6061
data: data,
62+
isLdap: isLdap,
6163
username: username[i],
6264
response: {
6365
error: function(message) {
@@ -74,6 +76,7 @@
7476
args.action({
7577
context: context,
7678
data: data,
79+
isLdap: isLdap,
7780
username: username,
7881
response: {
7982
error: function(message) {
@@ -188,7 +191,7 @@
188191
$wizard.find('.manual-account-details').append(informationNotInLdapForm);
189192

190193
return $wizard.dialog({
191-
title: _l('label.add.account'),
194+
title: ldapStatus ? _l('Add LDAP Account') : _l('label.add.account'),
192195
width: ldapStatus ? 800 : 330,
193196
height: ldapStatus ? 500 : 500,
194197
closeOnEscape: false,

0 commit comments

Comments
 (0)