første xml update
[virt-orchestrator.git] / vFLOWER / content / Workflows / uio / lib / ad / generate_password.workflow.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <workflow xmlns="http://vmware.com/vco/workflow" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://vmware.com/vco/workflow http://vmware.com/vco/workflow/Workflow-v4.xsd" root-name="item1" object-name="workflow:name=generic" id="e606a877-eb2a-4ff8-ba1c-2e48aba0e869" version="0.0.3" api-version="3.1.0" allowed-operations="fve" restartMode="1" resumeFromFailedMode="0">
3     <display-name>generate_password</display-name>
4
5     <description>Generate a dynamic password</description>
6
7     <position x="100.0" y="50.0"/>
8
9     <output>
10         <param name="passwd" type="SecureString"/>
11     </output>
12
13     <workflow-item name="item0" type="end" end-mode="0">
14         <position x="384.5" y="45.40909090909091"/>
15     </workflow-item>
16
17     <workflow-item name="item1" out-name="item0" type="task">
18         <display-name>Scriptable task</display-name>
19
20         <script encoded="false">
21 function password_generator( len ) {
22             var length = (len)?(len):(10);
23             var string = "abcdefghijklnopqrstuvwxyz"; //to upper 
24             var numeric = '0123456789';
25             var punctuation = '@%#&amp;=';
26             var passwd = "";
27             var character = "";
28             var crunch = true;
29             while( passwd.length&lt;length ) {
30                 entity1 = Math.ceil(string.length * Math.random()*Math.random());
31                 entity2 = Math.ceil(numeric.length * Math.random()*Math.random());
32                 entity3 = Math.ceil(punctuation.length * Math.random()*Math.random());
33                 hold = string.charAt( entity1 );
34                 hold = (entity1%2==0)?(hold.toUpperCase()):(hold);
35                 character += hold;
36                 character += numeric.charAt( entity2 );
37                 character += punctuation.charAt( entity3 );
38                 passwd = character;
39             }
40             return passwd;
41         }
42
43 var passwd=password_generator(16);
44 System.log('PASSWD_generated = '+passwd);
45 //System.log('PASSWD ='+password);
46         </script>
47
48         <in-binding/>
49
50         <out-binding>
51             <bind name="passwd" type="SecureString" export-name="passwd"/>
52         </out-binding>
53
54         <position x="204.5" y="55.40909090909091"/>
55     </workflow-item>
56
57     <presentation/>
58 </workflow>