mirror of
				https://github.com/apache/cloudstack.git
				synced 2025-10-26 08:42:29 +01:00 
			
		
		
		
	New LDAP UI
Signed-off-by: Sebastien Goasguen <runseb@gmail.com>
This commit is contained in:
		
							parent
							
								
									eaa4143371
								
							
						
					
					
						commit
						ec064b3077
					
				| @ -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= | ||||
| 
 | ||||
|  | ||||
| @ -12272,54 +12272,53 @@ div.ui-dialog div.autoscaler div.field-group div.form-container form div.form-it | ||||
|     width: 100%; | ||||
|     table-layout: fixed; | ||||
| } | ||||
| 
 | ||||
| .accounts-wizard .ui-button { | ||||
|     display: inline-block !important; | ||||
|     float: none !important; | ||||
| } | ||||
| .accounts-wizard td:last-child { | ||||
|     border: none; | ||||
| } | ||||
| 
 | ||||
| .accounts-wizard tbody tr:nth-child(even) { | ||||
|     background: #DFE1E3; | ||||
| } | ||||
| 
 | ||||
| .accounts-wizard tbody tr:nth-child(odd) { | ||||
|     background: #F2F0F0; | ||||
| } | ||||
| 
 | ||||
| .accounts-wizard .content { | ||||
|     display: inline-block; | ||||
| } | ||||
| 
 | ||||
| .accounts-wizard .content:last-child { | ||||
|     margin-left: 14px; | ||||
| } | ||||
| 
 | ||||
| .accounts-wizard .select-container { | ||||
|   overflow: auto; | ||||
| } | ||||
| 
 | ||||
| .accounts-wizard .input-area { | ||||
|     width: 320px; | ||||
|   font-size: 15px; | ||||
|     font-size: 13px; | ||||
|     color: #485867; | ||||
|     text-shadow: 0px 2px 1px #FFFFFF; | ||||
| } | ||||
| 
 | ||||
| .ldap-account-choice { | ||||
|     border: none !important; | ||||
|     border-radius: 0 0 0 0 !important; | ||||
| } | ||||
| 
 | ||||
| .manual-account-details .name { | ||||
|     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; | ||||
| } | ||||
| 
 | ||||
| .manual-account-details .form-item:after { | ||||
|     content:"."; | ||||
|     display: block; | ||||
| @ -12328,24 +12327,38 @@ div.ui-dialog div.autoscaler div.field-group div.form-container form div.form-it | ||||
|     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; | ||||
| } | ||||
| 
 | ||||
| .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; | ||||
| } | ||||
| 
 | ||||
| .manual-account-details > *:nth-child(odd) { | ||||
|     background: #F2F0F0; | ||||
| } | ||||
| 
 | ||||
| .manual-account-details .value { | ||||
|     display: inline-block; | ||||
| } | ||||
| @ -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 --> | ||||
|  | ||||
| @ -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,8 +166,88 @@ | ||||
| 
 | ||||
|         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("&domainid=" + args.data.domainid); | ||||
| 
 | ||||
|             var account = args.data.account; | ||||
|             if (account === null || account.length === 0) { | ||||
|                 account = args.username; | ||||
|             } | ||||
|             array1.push("&account=" + account); | ||||
| 
 | ||||
|             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=" + 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.length > 0) { | ||||
|                 array1.push("&networkdomain=" + args.data.networkdomain); | ||||
|             } | ||||
| 
 | ||||
|             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("&username=" + args.data.username); | ||||
|                     array1.push("&domainid=" + args.data.domainid); | ||||
| 
 | ||||
|                     if (args.data.account != null && args.data.account.length != 0) { | ||||
| @ -132,17 +262,15 @@ | ||||
|                     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); | ||||
|                     } | ||||
| 
 | ||||
|             console.log(array1.join("")); | ||||
|             console.log(args.data); | ||||
| 
 | ||||
|                     for (var i = 0; i < username.length; i++) { | ||||
|                         $.ajax({ | ||||
| 			url: createURL("ldapCreateAccount" + array1.join("")), | ||||
|                             url: createURL("ldapCreateAccount&username=" + username[i] + array1.join("")), | ||||
|                             dataType: "json", | ||||
|                             async: false, | ||||
|                             success: function(json) { | ||||
|                                 var item = json.createaccountresponse.account; | ||||
|                                 args.response.success({ | ||||
| @ -155,4 +283,6 @@ | ||||
|                         }); | ||||
|                     } | ||||
|                 } | ||||
|                 */ | ||||
|     }; | ||||
| }(cloudStack, jQuery)); | ||||
|  | ||||
| @ -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() { | ||||
|  | ||||
| @ -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,16 +33,18 @@ | ||||
| 
 | ||||
|                 var completeAction = function() { | ||||
|                     var data = cloudStack.serializeForm($form); | ||||
|                     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: { | ||||
|                             success: function(args) { | ||||
|                                 $('.list-view').listView('refresh'); | ||||
|                                 close(); | ||||
|                             }, | ||||
|                                     error: function(message) { | ||||
|                                 close(); | ||||
|                                         if (message) { | ||||
|                                             cloudStack.dialog.notice({ | ||||
|                                                 message: message | ||||
| @ -52,39 +54,44 @@ | ||||
|                                 } | ||||
|                             }); | ||||
|                         } | ||||
|                     } 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({ | ||||
|                     context: context, | ||||
|                     noDialog: true, | ||||
|                     form: { | ||||
|                         title: '', | ||||
|                         fields: args.manuallyInputtedAccountInformation | ||||
|                     } | ||||
|                 }); | ||||
| 
 | ||||
|                 var $manualDetails = form.$formContainer.find('form .form-item'); | ||||
|                 $wizard.find('.manual-account-details').append($manualDetails); | ||||
| 
 | ||||
|                 if (ldapStatus) { | ||||
|                     var $table = $wizard.find('.ldap-account-choice tbody'); | ||||
| 
 | ||||
|                     $.ajax({ | ||||
|                         url: createURL("listAllLdapUsers"), | ||||
|                         dataType: "json", | ||||
| @ -92,23 +99,63 @@ | ||||
|                         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><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.informationNotInLdap | ||||
|                     } | ||||
|                 }); | ||||
| 
 | ||||
|                 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); | ||||
|         }; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user