cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From seb...@apache.org
Subject git commit: updated refs/heads/ldapplugin to ec064b3
Date Mon, 29 Jul 2013 10:02:50 GMT
Updated Branches:
  refs/heads/ldapplugin eaa414337 -> ec064b307


New LDAP UI

Signed-off-by: Sebastien Goasguen <runseb@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ec064b30
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ec064b30
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ec064b30

Branch: refs/heads/ldapplugin
Commit: ec064b307734dcb1d4304454de466d6e70e019fb
Parents: eaa4143
Author: Ian Duffy <ian@ianduffy.ie>
Authored: Mon Jul 29 05:58:00 2013 -0400
Committer: Sebastien Goasguen <runseb@gmail.com>
Committed: Mon Jul 29 05:58:00 2013 -0400

----------------------------------------------------------------------
 .../ldap/test/resources/cloudstack.org.ldif     | 263 +++++++++++++++++++
 ui/css/cloudstack3.css                          | 117 +++++----
 ui/index.jsp                                    |   8 +-
 ui/scripts/accounts.js                          |   2 +-
 ui/scripts/accountsWizard.js                    | 190 +++++++++++---
 ui/scripts/sharedFunctions.js                   |  16 ++
 ui/scripts/ui-custom/accountsWizard.js          | 141 ++++++----
 7 files changed, 603 insertions(+), 134 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ec064b30/plugins/user-authenticators/ldap/test/resources/cloudstack.org.ldif
----------------------------------------------------------------------
diff --git a/plugins/user-authenticators/ldap/test/resources/cloudstack.org.ldif b/plugins/user-authenticators/ldap/test/resources/cloudstack.org.ldif
index b20de81..f46a383 100644
--- a/plugins/user-authenticators/ldap/test/resources/cloudstack.org.ldif
+++ b/plugins/user-authenticators/ldap/test/resources/cloudstack.org.ldif
@@ -17,3 +17,266 @@ givenName: Ryan
 mail: rmurphy@cloudstack.org
 uid: rmurphy
 userpassword:: cGFzc3dvcmQ=
+
+dn: cn=Barbara Brewer,dc=cloudstack,dc=org
+objectClass: inetOrgPerson
+objectClass: organizationalPerson
+objectClass: person
+objectClass: top
+cn: Barbara Brewer
+sn: Brewer
+mail: bbrewer@cloudstack.org
+uid: bbrewer
+userpassword:: cGFzc3dvcmQ=
+
+dn: cn=Zak Wilkinson,dc=cloudstack,dc=org
+objectClass: inetOrgPerson
+objectClass: organizationalPerson
+objectClass: person
+objectClass: top
+cn: Zak Wilkinson
+givenname: Zak
+sn: Wilkinson
+uid: zwilkinson
+userpassword:: cGFzc3dvcmQ=
+
+dn: cn=Archie Shingleton,dc=cloudstack,dc=org
+objectClass: inetOrgPerson
+objectClass: organizationalPerson
+objectClass: person
+objectClass: top
+cn: Archie Shingleton
+sn: Shingleton
+givenName: Archie
+mail: ashingleton@cloudstack.org
+uid: ashingleton
+userpassword:: cGFzc3dvcmQ=
+
+dn: cn=Cletus Pears,dc=cloudstack,dc=org
+objectClass: inetOrgPerson
+objectClass: organizationalPerson
+objectClass: person
+objectClass: top
+cn: Cletus Pears
+sn: Pears
+givenName: Cletus
+mail: cpears@cloudstack.org
+uid: cpears
+userpassword:: cGFzc3dvcmQ=
+
+dn: cn=Teisha Milewski,dc=cloudstack,dc=org
+objectClass: inetOrgPerson
+objectClass: organizationalPerson
+objectClass: person
+objectClass: top
+cn: Teisha Milewski
+sn: Milewski
+givenName: Teisha
+mail: tmilewski@cloudstack.org
+uid: tmilewski
+userpassword:: cGFzc3dvcmQ=
+
+dn: cn=Eloy Para,dc=cloudstack,dc=org
+objectClass: inetOrgPerson
+objectClass: organizationalPerson
+objectClass: person
+objectClass: top
+cn: Eloy Para
+sn: Para
+givenName: Eloy
+mail: epara@cloudstack.org
+uid: epara
+userpassword:: cGFzc3dvcmQ=
+
+dn: cn=Elaine Lamb,dc=cloudstack,dc=org
+objectClass: inetOrgPerson
+objectClass: organizationalPerson
+objectClass: person
+objectClass: top
+cn: Elaine Lamb
+sn: Lamb
+givenName: Elaine
+mail: elamb@cloudstack.org
+uid: elamb
+userpassword:: cGFzc3dvcmQ=
+
+dn: cn=Soon Griffen,dc=cloudstack,dc=org
+objectClass: inetOrgPerson
+objectClass: organizationalPerson
+objectClass: person
+objectClass: top
+cn: Soon Griffen
+sn: Griffen
+givenName: Soon
+mail: sgriffen@cloudstack.org
+uid: sgriffen
+userpassword:: cGFzc3dvcmQ=
+
+dn: cn=Tran Neisler,dc=cloudstack,dc=org
+objectClass: inetOrgPerson
+objectClass: organizationalPerson
+objectClass: person
+objectClass: top
+cn: Tran Neisler
+sn: Neisler
+givenName: Tran
+mail: tneisler@cloudstack.org
+uid: tneisler
+userpassword:: cGFzc3dvcmQ=
+
+dn: cn=Mirella Zeck,dc=cloudstack,dc=org
+objectClass: inetOrgPerson
+objectClass: organizationalPerson
+objectClass: person
+objectClass: top
+cn: Mirella Zeck
+sn: Zeck
+givenName: Mirella
+mail: mzeck@cloudstack.org
+uid: mzeck
+userpassword:: cGFzc3dvcmQ=
+
+dn: cn=Greg Hoskin,dc=cloudstack,dc=org
+objectClass: inetOrgPerson
+objectClass: organizationalPerson
+objectClass: person
+objectClass: top
+cn: Greg Hoskin
+sn: Hoskin
+givenName: Greg
+mail: ghoskin@cloudstack.org
+uid: ghoskin
+userpassword:: cGFzc3dvcmQ=
+
+dn: cn=Johanne Runyon,dc=cloudstack,dc=org
+objectClass: inetOrgPerson
+objectClass: organizationalPerson
+objectClass: person
+objectClass: top
+cn: Johanne Runyon
+sn: Runyon
+givenName: Johanne
+mail: jrunyon@cloudstack.org
+uid: jrunyon
+userpassword:: cGFzc3dvcmQ=
+
+dn: cn=Mabelle Waiters,dc=cloudstack,dc=org
+objectClass: inetOrgPerson
+objectClass: organizationalPerson
+objectClass: person
+objectClass: top
+cn: Mabelle Waiters
+sn: Waiters
+givenName: Mabelle
+mail: mwaiters@cloudstack.org
+uid: mwaiters
+userpassword:: cGFzc3dvcmQ=
+
+dn: cn=Phillip Fruge,dc=cloudstack,dc=org
+objectClass: inetOrgPerson
+objectClass: organizationalPerson
+objectClass: person
+objectClass: top
+cn: Phillip Fruge
+sn: Fruge
+givenName: Phillip
+mail: pfruge@cloudstack.org
+uid: pfruge
+userpassword:: cGFzc3dvcmQ=
+
+dn: cn=Jayna Ridenhour,dc=cloudstack,dc=org
+objectClass: inetOrgPerson
+objectClass: organizationalPerson
+objectClass: person
+objectClass: top
+cn: Jayna Ridenhour
+sn: Ridenhour
+givenName: Jayna
+mail: jridenhour@cloudstack.org
+uid: jridenhour
+userpassword:: cGFzc3dvcmQ=
+
+dn: cn=Marlyn Mandujano,dc=cloudstack,dc=org
+objectClass: inetOrgPerson
+objectClass: organizationalPerson
+objectClass: person
+objectClass: top
+cn: Marlyn Mandujano
+sn: Mandujano
+givenName: Marlyn
+mail: mmandujano@cloudstack.org
+uid: mmandujano
+userpassword:: cGFzc3dvcmQ=
+
+dn: cn=Shaunna Scherer,dc=cloudstack,dc=org
+objectClass: inetOrgPerson
+objectClass: organizationalPerson
+objectClass: person
+objectClass: top
+cn: Shaunna Scherer
+sn: Scherer
+givenName: Shaunna
+mail: sscherer@cloudstack.org
+uid: sscherer
+userpassword:: cGFzc3dvcmQ=
+
+dn: cn=Adriana Bozek,dc=cloudstack,dc=org
+objectClass: inetOrgPerson
+objectClass: organizationalPerson
+objectClass: person
+objectClass: top
+cn: Adriana Bozek
+sn: Bozek
+givenName: Adriana
+mail: abozek@cloudstack.org
+uid: abozek
+userpassword:: cGFzc3dvcmQ=
+
+dn: cn=Silvana Chipman,dc=cloudstack,dc=org
+objectClass: inetOrgPerson
+objectClass: organizationalPerson
+objectClass: person
+objectClass: top
+cn: Silvana Chipman
+sn: Chipman
+givenName: Silvana
+mail: schipman@cloudstack.org
+uid: schipman
+userpassword:: cGFzc3dvcmQ=
+
+dn: cn=Marion Wasden,dc=cloudstack,dc=org
+objectClass: inetOrgPerson
+objectClass: organizationalPerson
+objectClass: person
+objectClass: top
+cn: Marion Wasden
+sn: Wasden
+givenName: Marion
+mail: mwasden@cloudstack.org
+uid: mwasden
+userpassword:: cGFzc3dvcmQ=
+
+dn: cn=Anisa Casson,dc=cloudstack,dc=org
+objectClass: inetOrgPerson
+objectClass: organizationalPerson
+objectClass: person
+objectClass: top
+cn: Anisa Casson
+sn: Casson
+givenName: Anisa
+mail: acasson@cloudstack.org
+uid: acasson
+userpassword:: cGFzc3dvcmQ=
+
+dn: cn=Cammy Petri,dc=cloudstack,dc=org
+objectClass: inetOrgPerson
+objectClass: organizationalPerson
+objectClass: person
+objectClass: top
+cn: Cammy Petri
+sn: Petri
+givenName: Cammy
+mail: cpetri@cloudstack.org
+uid: cpetri
+userpassword:: cGFzc3dvcmQ=
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ec064b30/ui/css/cloudstack3.css
----------------------------------------------------------------------
diff --git a/ui/css/cloudstack3.css b/ui/css/cloudstack3.css
index 93658db..a419194 100644
--- a/ui/css/cloudstack3.css
+++ b/ui/css/cloudstack3.css
@@ -12268,84 +12268,97 @@ div.ui-dialog div.autoscaler div.field-group div.form-container
form div.form-it
 }
 
 .accounts-wizard table {
-  margin: 0;
-  width: 100%;
-  table-layout: fixed;
+    margin: 0;
+    width: 100%;
+    table-layout: fixed;
+}
+.accounts-wizard .ui-button {
+    display: inline-block !important;
+    float: none !important;
 }
-
 .accounts-wizard td:last-child {
-  border: none;
+    border: none;
 }
-
 .accounts-wizard tbody tr:nth-child(even) {
-  background: #DFE1E3;
+    background: #DFE1E3;
 }
-
 .accounts-wizard tbody tr:nth-child(odd) {
-  background: #F2F0F0;
+    background: #F2F0F0;
 }
-
 .accounts-wizard .content {
-  display: inline-block;
+    display: inline-block;
 }
-
 .accounts-wizard .content:last-child {
-  margin-left: 14px;
+    margin-left: 14px;
 }
-
-.accounts-wizard .select-container {
-  overflow: auto;
+.accounts-wizard .input-area {
+    width: 320px;
+    font-size: 13px;
+    color: #485867;
+    text-shadow: 0px 2px 1px #FFFFFF;
 }
-
-.accounts-wizard .input-area{
-  width: 320px;
-  font-size: 15px;
-  color: #485867;
-  text-shadow: 0px 2px 1px #FFFFFF;
-}
-
 .ldap-account-choice {
-  border: none !important;
-  border-radius: 0 0 0 0 !important;
+    border: none !important;
+    border-radius: 0 0 0 0 !important;
 }
-
 .manual-account-details .name {
-  margin-top: 2px;
-  width: 100px;
-  float: left;
-  padding-bottom:10px;
+    margin-top: 2px;
+    width: 100px;
+    float: left;
+    padding-bottom:10px;
+}
+.manual-account-details {
+    height: auto !important;
+    overflow: visible !important;
+    overflow-x: visible !important;
+}
+.manual-account-details label.error {
+    display: block;
+    font-size: 10px;
 }
-
 .manual-account-details .value {
-  float: left;
+    float: left;
 }
-
 .manual-account-details .form-item:after {
-  content: ".";
-  display: block;
-  clear: both;
-  visibility: hidden;
-  line-height: 0;
-  height: 0;
+    content:".";
+    display: block;
+    clear: both;
+    visibility: hidden;
+    line-height: 0;
+    height: 0;
 }
-
 .manual-account-details .form-item {
-  padding: 10px;
-  width: 278px;
+    padding: 5px;
+    width: 100%;
+    -webkit-box-sizing: border-box;
+    -moz-box-sizing: border-box;
+    box-sizing: border-box;
 }
-
 .manual-account-details select, .manual-account-details input {
-  width: 150px;
+    width: 150px;
+}
+.manual-account-details input {
+    background: #F6F6F6;
+    -moz-border-radius: 4px;
+    -webkit-border-radius: 4px;
+    -khtml-border-radius: 4px;
+    border-radius: 4px;
+    border-radius: 4px 4px 4px 4px;
+    border: 1px solid #AFAFAF;
+    -moz-box-shadow: inset 0px 1px #727272;
+    -webkit-box-shadow: inset 0px 1px #727272;
+    -o-box-shadow: inset 0px 1px #727272;
+    box-shadow: inset 0px 1px #727272;
+    -moz-box-shadow: inset 0px 1px 0px #727272;
+    -webkit-box-shadow: inset 0px 1px 0px #727272;
+    -o-box-shadow: inset 0px 1px 0px #727272;
 }
-
 .manual-account-details > *:nth-child(even) {
-  background: #DFE1E3;
+    background: #DFE1E3;
 }
-
 .manual-account-details > *:nth-child(odd) {
-  background: #F2F0F0;
+    background: #F2F0F0;
 }
-
 .manual-account-details .value {
-  display: inline-block;
-}
\ No newline at end of file
+    display: inline-block;
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ec064b30/ui/index.jsp
----------------------------------------------------------------------
diff --git a/ui/index.jsp b/ui/index.jsp
index 813dbcb..e193c22 100644
--- a/ui/index.jsp
+++ b/ui/index.jsp
@@ -473,8 +473,8 @@ under the License.
       <div class="multi-wizard accounts-wizard">
         <form>
           <div class="steps">
-              <div class="content">
-                <div class="select-container ldap-account-choice">
+              <div class="content ldap-account-choice">
+                <div class="select-container">
                   <table>
                     <thead>
                       <tr>
@@ -496,8 +496,8 @@ under the License.
           </div>
         </form>
         <div class="buttons">
-          <div class="button cancel"><span><fmt:message key="label.cancel"/></span></div>
-          <div class="button next"><span><fmt:message key="label.add"/></span></div>
+          <button class="cancel ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"><span><fmt:message
key="label.cancel"/></span></button>
+          <button class="next ok ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"><span><fmt:message
key="label.add"/></span></button>
         </div>
       </div>
       <!-- Zone wizard -->

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ec064b30/ui/scripts/accounts.js
----------------------------------------------------------------------
diff --git a/ui/scripts/accounts.js b/ui/scripts/accounts.js
index e3e28e4..43b242d 100644
--- a/ui/scripts/accounts.js
+++ b/ui/scripts/accounts.js
@@ -1287,7 +1287,7 @@
                                     $.ajax({
                                         url: createURL('updateUser'),
                                         data: data,
-                                        type: "POST",                                   
    
+                                        type: "POST",
                                         success: function(json) {
                                             args.response.success({
                                                 data: json.updateuserresponse.user

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ec064b30/ui/scripts/accountsWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/accountsWizard.js b/ui/scripts/accountsWizard.js
index a350085..70ef082 100644
--- a/ui/scripts/accountsWizard.js
+++ b/ui/scripts/accountsWizard.js
@@ -18,7 +18,57 @@
 (function(cloudStack, $) {
     cloudStack.accountsWizard = {
 
-        manuallyInputtedAccountInformation: {
+        informationWithinLdap: {
+            username: {
+                label: 'label.username',
+                validation: {
+                    required: true
+                },
+                docID: 'helpAccountUsername'
+            },
+            password: {
+                label: 'label.password',
+                validation: {
+                    required: true
+                },
+                isPassword: true,
+                id: 'password',
+                docID: 'helpAccountPassword'
+            },
+            'password-confirm': {
+                label: 'label.confirm.password',
+                validation: {
+                    required: true,
+                    equalTo: '#password'
+                },
+                isPassword: true,
+                docID: 'helpAccountConfirmPassword'
+            },
+            email: {
+                label: 'label.email',
+                validation: {
+                    required: true,
+                    email: true
+                },
+                docID: 'helpAccountEmail'
+            },
+            firstname: {
+                label: 'label.first.name',
+                validation: {
+                    required: true
+                },
+                docID: 'helpAccountFirstName'
+            },
+            lastname: {
+                label: 'label.last.name',
+                validation: {
+                    required: true
+                },
+                docID: 'helpAccountLastName'
+            }
+        },
+
+        informationNotInLdap: {
             domainid: {
                 label: 'label.domain',
                 docID: 'helpAccountDomain',
@@ -48,7 +98,7 @@
                                     description: this.path
                                 });
 
-                                if (this.level == 0)
+                                if (this.level === 0)
                                     rootDomainId = this.id;
                             });
                             args.response.success({
@@ -62,8 +112,8 @@
                 label: 'label.account',
                 docID: 'helpAccountAccount',
                 validation: {
-                    required: true
-                },
+                    required: false
+                }
             },
             accounttype: {
                 label: 'label.type',
@@ -116,43 +166,123 @@
 
         action: function(args) {
             var array1 = [];
+            var ldapStatus = isLdapEnabled();
+            console.log("creating user: " + args.username);
+            array1.push("&username=" + args.username);
+
+            if (!ldapStatus) {
+                var password = args.data.password;
+                if (md5Hashed) {
+                    password = $.md5(password);
+                }
+                array1.push("&email=" + args.data.email);
+                array1.push("&firstname=" + args.data.firstname);
+                array1.push("&lastname=" + args.data.lastname);
+
+                var password = args.data.password;
+                if (md5Hashed) {
+                    password = $.md5(password);
+                }
+                array1.push("&password=" + password);
+            }
 
-            array1.push("&username=" + args.data.username);
             array1.push("&domainid=" + args.data.domainid);
 
-            if (args.data.account != null && args.data.account.length != 0) {
-                array1.push("&account=" + args.data.account);
+            var account = args.data.account;
+            if (account === null || account.length === 0) {
+                account = args.username;
             }
+            array1.push("&account=" + account);
 
-            if (args.data.accounttype == "1" && args.data.domainid != rootDomainId)
{
-                args.data.accounttype = "2";
+            var accountType = args.data.accounttype;
+            if (args.data.accounttype == "1" && args.data.domainid != rootDomainId)
{ //if account type is admin, but domain is not Root domain
+                accountType = "2"; // Change accounttype from root-domain("1") to domain-admin("2")
             }
-            array1.push("&accountType=" + args.data.accounttype);
+            array1.push("&accounttype=" + accountType);
 
-            if (args.data.timezone != null && args.data.timezone.length != 0) {
+            if (args.data.timezone !== null && args.data.timezone.length > 0)
{
                 array1.push("&timezone=" + args.data.timezone);
             }
 
-            if (args.data.networkdomain != null && args.data.networkdomain != 0)
{
-                array1.push("&networkDomain=" + args.data.networkdomain);
+            if (args.data.networkdomain !== null && args.data.networkdomain.length
> 0) {
+                array1.push("&networkdomain=" + args.data.networkdomain);
             }
 
-            console.log(array1.join(""));
-            console.log(args.data);
-
-		$.ajax({
-			url: createURL("ldapCreateAccount" + array1.join("")),
-			dataType: "json",
-			success: function(json) {
-				var item = json.createaccountresponse.account;
-				args.response.success({
-					data: item
-				});
-			},
-			error: function(XMLHttpResponse) {
-				args.response.error(parseXMLHttpResponse(XMLHttpResponse));
-			}
-		});
+            if (ldapStatus) {
+                console.log("doing an ldap add");
+                $.ajax({
+                    url: createURL('ldapCreateAccount' + array1.join("")),
+                    dataType: "json",
+                    async: false,
+                    success: function(json) {
+                        var item = json.createaccountresponse.account;
+                        args.response.success({
+                            data: item
+                        });
+                    },
+                    error: function(XMLHttpResponse) {
+                        args.response.error(parseXMLHttpResponse(XMLHttpResponse));
+                    }
+                });
+            } else {
+                console.log("doing normal user add");
+                $.ajax({
+                    url: createURL('createAccount' + array1.join("")),
+                    dataType: "json",
+                    async: false,
+                    success: function(json) {
+                        var item = json.createaccountresponse.account;
+                        args.response.success({
+                            data: item
+                        });
+                    },
+                    error: function(XMLHttpResponse) {
+                        args.response.error(parseXMLHttpResponse(XMLHttpResponse));
+                    }
+                });
+            }
         }
-    }
+        /*
+                action: function(args) {
+                    var array1 = [];
+
+                    var username = args.data.username;
+
+                    array1.push("&domainid=" + args.data.domainid);
+
+                    if (args.data.account != null && args.data.account.length !=
0) {
+                        array1.push("&account=" + args.data.account);
+                    }
+
+                    if (args.data.accounttype == "1" && args.data.domainid != rootDomainId)
{
+                        args.data.accounttype = "2";
+                    }
+                    array1.push("&accountType=" + args.data.accounttype);
+
+                    if (args.data.timezone != null && args.data.timezone.length !=
0) {
+                        array1.push("&timezone=" + args.data.timezone);
+                    }
+                    if (args.data.networkdomain != null && args.data.networkdomain
!= 0) {
+                        array1.push("&networkDomain=" + args.data.networkdomain);
+                    }
+
+                    for (var i = 0; i < username.length; i++) {
+                        $.ajax({
+                            url: createURL("ldapCreateAccount&username=" + username[i]
+ array1.join("")),
+                            dataType: "json",
+                            async: false,
+                            success: function(json) {
+                                var item = json.createaccountresponse.account;
+                                args.response.success({
+                                    data: item
+                                });
+                            },
+                            error: function(XMLHttpResponse) {
+                                args.response.error(parseXMLHttpResponse(XMLHttpResponse));
+                            }
+                        });
+                    }
+                }
+                */
+    };
 }(cloudStack, jQuery));

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ec064b30/ui/scripts/sharedFunctions.js
----------------------------------------------------------------------
diff --git a/ui/scripts/sharedFunctions.js b/ui/scripts/sharedFunctions.js
index 6c1b009..a9df896 100644
--- a/ui/scripts/sharedFunctions.js
+++ b/ui/scripts/sharedFunctions.js
@@ -699,6 +699,22 @@ var addGuestNetworkDialog = {
 }
 
 
+    function isLdapEnabled() {
+        var result;
+        $.ajax({
+            url: createURL("listLdapConfigurations"),
+            dataType: "json",
+            async: false,
+            success: function(json) {
+                result = (json.ldapconfigurationresponse.count > 0);
+            },
+            error: function(json) {
+                result = false;
+            }
+        });
+        return result;
+    }
+
 // Role Functions
 
     function isAdmin() {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ec064b30/ui/scripts/ui-custom/accountsWizard.js
----------------------------------------------------------------------
diff --git a/ui/scripts/ui-custom/accountsWizard.js b/ui/scripts/ui-custom/accountsWizard.js
index 4037788..7951553 100644
--- a/ui/scripts/ui-custom/accountsWizard.js
+++ b/ui/scripts/ui-custom/accountsWizard.js
@@ -19,7 +19,7 @@
     cloudStack.uiCustom.accountsWizard = function(args) {
         return function(listViewArgs) {
             var context = listViewArgs.context;
-
+            var ldapStatus = isLdapEnabled();
             var accountsWizard = function(data) {
                 var $wizard = $('#template').find('div.accounts-wizard').clone();
                 var $form = $wizard.find('form');
@@ -33,82 +33,129 @@
 
                 var completeAction = function() {
                     var data = cloudStack.serializeForm($form);
-                    args.action({
-                        context: context,
-                        data: data,
-                        response: {
-                            success: function(args) {
-                                $('.list-view').listView('refresh');
-                                close();
-                            },
-                            error: function(message) {
-                                close();
-                                if(message) {
-                                    cloudStack.dialog.notice({
-                                        message: message
-                                    });
+                    var username = data.username;
+                    var bulkAdd = (username instanceof Array);
+                    if (bulkAdd) {
+                        console.log("doing bulk add");
+                        for (var i = 0; i < username.length; i++) {
+                            console.log("creating user " + username[i]);
+                            args.action({
+                                context: context,
+                                data: data,
+                                username: username[i],
+                                response: {
+                                    error: function(message) {
+                                        if (message) {
+                                            cloudStack.dialog.notice({
+                                                message: message
+                                            });
+                                        }
+                                    }
                                 }
-                            }
+                            });
                         }
-                    });
-                }
+                    } else {
+                        args.action({
+                            context: context,
+                            data: data,
+                            username: username,
+                            response: {
+                                error: function(message) {
+                                    if (message) {
+                                        cloudStack.dialog.notice({
+                                            message: message
+                                        });
+                                    }
+                                }
+                            }
+                        });
+                    }
+                };
 
                 $wizard.click(function(event) {
                     var $target = $(event.target);
-                    if ($target.closest('div.button.next').size()) {
+                    if ($target.closest('button.next').size()) {
                         $form.validate();
                         if ($form.valid()) {
                             completeAction();
+                            $(window).trigger('cloudStack.fullRefresh');
+                            close();
                             return true;
-                        } else {
-                            return false;
                         }
                     }
 
-                    if ($target.closest('div.button.cancel').size()) {
+                    if ($target.closest('button.cancel').size()) {
                         close();
                         return false;
                     }
                 });
 
-                var form = cloudStack.dialog.createForm({
+                if (ldapStatus) {
+                    var $table = $wizard.find('.ldap-account-choice tbody');
+                    $.ajax({
+                        url: createURL("listAllLdapUsers"),
+                        dataType: "json",
+                        async: false,
+                        success: function(json) {
+                            $(json.ldapuserresponse.LdapUser).each(function() {
+                                var result = $("<tr>");
+                                result.append("<td><input type=\"checkbox\" class=\"required\"
name=\"username\" value=\"" + this.username + "\"></td>");
+                                result.append("<td>" + this.firstname + " " + this.lastname
+ "</td>");
+                                result.append("<td>" + this.username + "</td>");
+                                result.append("<td>" + this.email + "</td>");
+                                $table.append(result);
+                            });
+                        }
+                    });
+                } else {
+                    var informationWithinLdap = cloudStack.dialog.createForm({
+                        context: context,
+                        noDialog: true,
+                        form: {
+                            title: '',
+                            fields: args.informationWithinLdap
+                        }
+                    });
+
+                    //console.log(informationWithinLdap.$formContainer);
+                    var informationWithinLdapForm = informationWithinLdap.$formContainer.find('form
.form-item');
+                    informationWithinLdapForm.find('.value #label_username').addClass('required');
+                    informationWithinLdapForm.find('.value #password').addClass('required');
+                    informationWithinLdapForm.find('.value #label_confirm_password').addClass('required');
+                    informationWithinLdapForm.find('.value #label_confirm_password').attr('equalTo',
'#password');
+                    informationWithinLdapForm.find('.value #label_email').addClass('required');
+                    informationWithinLdapForm.find('.value #label_first_name').addClass('required');
+                    informationWithinLdapForm.find('.value #label_last_name').addClass('required');
+                    $wizard.find('.manual-account-details').append(informationWithinLdapForm).children().css('background',
'none');
+                    $wizard.find('.ldap-account-choice').css('display', 'none');
+                    $wizard.removeClass('multi-wizard');
+                }
+
+                var informationNotInLdap = cloudStack.dialog.createForm({
                     context: context,
                     noDialog: true,
                     form: {
                         title: '',
-                        fields: args.manuallyInputtedAccountInformation
+                        fields: args.informationNotInLdap
                     }
                 });
 
-                var $manualDetails = form.$formContainer.find('form .form-item');
-                $wizard.find('.manual-account-details').append($manualDetails);
-
-                var $table = $wizard.find('.ldap-account-choice tbody');
-
-                $.ajax({
-                    url: createURL("listAllLdapUsers"),
-                    dataType: "json",
-                    async: false,
-                    success: function(json) {
-                        $(json.ldapuserresponse.LdapUser).each(function() {
-                            var result = $("<tr>");
-                            result.append("<td><input type=\"radio\" class=\"required\"
name=\"username\" value=\"" + this.username + "\"></td>");
-                            result.append("<td>" + this.firstname + " " + this.lastname
+ "</td>");
-                            result.append("<td>" + this.username + "</td>");
-                            result.append("<td>" + this.email + "</td>");
-                            $table.append(result);
-                        })
-                    }
-                });
+                var informationNotInLdapForm = informationNotInLdap.$formContainer.find('form
.form-item');
+                informationNotInLdapForm.find('.value #label_domain').addClass('required');
+                informationNotInLdapForm.find('.value #label_type').addClass('required');
+                if (!ldapStatus) {
+                    informationNotInLdapForm.css('background', 'none');
+                }
+                $wizard.find('.manual-account-details').append(informationNotInLdapForm);
 
                 return $wizard.dialog({
                     title: _l('label.add.account'),
-                    width: 800,
-                    height: 500,
+                    width: ldapStatus ? 800 : 330,
+                    height: ldapStatus ? 500 : 500,
                     closeOnEscape: false,
                     zIndex: 5000
                 }).closest('.ui-dialog').overlay();
-            }
+            };
 
             accountsWizard(args);
         };


Mime
View raw message