comparison apolloUserManager.xml @ 0:ce4f91831680 draft default tip

planemo upload for repository https://github.com/Yating-L/suite_gonramp_apollo.git commit 5367a00befb467f162d1870edb91f9face72e894
author yating-l
date Fri, 16 Feb 2018 10:57:13 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:ce4f91831680
1 <tool id="apollo_user_manager" name="Apollo User Manager" version="1.0.0">
2 <description>
3 This Galaxy tool is used to manage Apollo users.
4 </description>
5 <macros>
6 <import>macros.xml</import>
7 </macros>
8
9 <requirements>
10 <requirement type="package" version="3.0.3">apollo_api</requirement>
11 </requirements>
12
13 <stdio>
14 </stdio>
15
16 <command detect_errors="exit_code"><![CDATA[
17 mkdir -p $output.extra_files_path;
18 ## Dump the tool parameters into a JSON file
19 python $json_file parameters.json;
20 python $__tool_directory__/apolloUserManager.py --data_json parameters.json -o $output
21 ]]></command>
22 <configfiles>
23 <configfile name="json_file">
24 import json
25 import sys
26
27 file_path = sys.argv[1]
28 #set global data_parameter_dict = {"operations": dict()}
29 ## Function to retrieve the data of the inputs
30 #def prepare_json($operation_type, $data_dict, $batch)
31 #silent $data_dict.update({"batch": str($batch)})
32 #if $operation_type in $data_parameter_dict["operations"]
33 #silent $data_parameter_dict["operations"][$operation_type].append($data_dict)
34 #else
35 #set array_inputs = []
36 #silent $array_inputs.append($data_dict)
37 #silent $data_parameter_dict["operations"].update({$operation_type: $array_inputs})
38 #end if
39 #end def
40
41
42
43
44 #for $i, $f in enumerate($operation)
45 #if $f.operation_type_selector.operation_type == "create"
46 #set batch = $f.operation_type_selector.batch_selector.batch
47 #if $batch == "false"
48 #set data_dict = {"useremail": str($f.operation_type_selector.batch_selector.user_email),
49 "firstname": str($f.operation_type_selector.batch_selector.firstname),
50 "lastname": str($f.operation_type_selector.batch_selector.lastname),
51 "password": str($f.operation_type_selector.batch_selector.password)}
52
53 #else
54 #set data_dict = {"format": str($f.operation_type_selector.batch_selector.format),
55 "false_path": str($f.operation_type_selector.batch_selector.user_info_file)}
56 #end if
57 #silent $prepare_json("create", $data_dict, $batch)
58
59 #elif $f.operation_type_selector.operation_type == "delete"
60 #set batch = $f.operation_type_selector.batch_selector.batch
61 #if $batch == "false"
62 #set data_dict = {"useremail": str($f.operation_type_selector.batch_selector.user_email)}
63 #else
64 #set data_dict = {"format": str($f.operation_type_selector.batch_selector.format),
65 "false_path": str($f.operation_type_selector.batch_selector.user_info_file)}
66 #end if
67 #silent $prepare_json("delete", $data_dict, $batch)
68 #elif $f.operation_type_selector.operation_type == "add"
69 #set batch = $f.operation_type_selector.batch_selector.batch
70 #if $batch == "false"
71 #set data_dict = {"useremail": str($f.operation_type_selector.batch_selector.user_email),
72 "group": str($f.operation_type_selector.batch_selector.group_name)}
73 #else
74 #set data_dict = {"format": str($f.operation_type_selector.batch_selector.format),
75 "false_path": str($f.operation_type_selector.batch_selector.user_info_file)}
76 #end if
77 #silent $prepare_json("add", $data_dict, $batch)
78 #elif $f.operation_type_selector.operation_type == "remove"
79 #set batch = $f.operation_type_selector.batch_selector.batch
80 #if $batch == "false"
81 #set data_dict = {"useremail": str($f.operation_type_selector.batch_selector.user_email),
82 "group": str($f.operation_type_selector.batch_selector.group_name)}
83 #else
84 #set data_dict = {"format": str($f.operation_type_selector.batch_selector.format),
85 "false_path": str($f.operation_type_selector.batch_selector.user_info_file)}
86 #end if
87 #silent $prepare_json("remove", $data_dict, $batch)
88 #end if
89 #end for
90
91
92 #set apollo_admin = {"user_email": str($admin_username), "password": str($admin_password)}
93 #silent $data_parameter_dict.update({"apollo_admin": $apollo_admin})
94 #silent $data_parameter_dict.update({"tool_directory": str($__tool_directory__)})
95 #silent $data_parameter_dict.update({"extra_files_path": str($output.extra_files_path)})
96 #silent $data_parameter_dict.update({"port": str($advanced_options.port)})
97 #silent $data_parameter_dict.update({"debug_mode": str($advanced_options.debug_mode)})
98 with open(file_path, 'w') as f:
99 json.dump($data_parameter_dict, f)
100 </configfile>
101 </configfiles>
102
103
104 <inputs>
105 <param name="admin_username" type="text" label="Admin username" help="Login in with Apollo admin account">
106 <sanitizer>
107 <valid initial="string.letters,string.digits">
108 <add value="@-=_.()/+*^,:?!"/>
109 </valid>
110 </sanitizer>
111 </param>
112
113 <param
114 name="admin_password"
115 type="text"
116 label="Admin password"
117 />
118
119 <repeat name="operation" title="New operation">
120 <conditional name="operation_type_selector" >
121 <param name="operation_type" type="select" label="Create a user, delete a user, add a user to a group or remove a user from a group">
122 <option value="create">Create a user</option>
123 <option value="delete">Delete a users</option>
124 <option value="add">Add a user to a group</option>
125 <option value="remove">Remove a user from a group</option>
126 </param>
127 <when value="create">
128 <conditional name="batch_selector">
129 <param name="batch" type="select" label="Manipulate a single user or multiple users">
130 <option value="false" selected="true">Single user</option>
131 <option value="true">Multiple users</option>
132 </param>
133 <when value="false">
134 <param name="user_email" type="text" label="User email" help="Specify the user email">
135 <sanitizer>
136 <valid initial="string.letters,string.digits">
137 <add value="@-=_.()/+*^,:?!"/>
138 </valid>
139 </sanitizer>
140 </param>
141 <param name="firstname" type="text" label="First name" />
142 <param name="lastname" type="text" label="Last name" />
143 <param name="password" type="text" label="Password" />
144 </when>
145 <when value="true">
146 <expand macro="upload_text_file" />
147 </when>
148 </conditional>
149 </when>
150 <when value="delete">
151 <conditional name="batch_selector">
152 <param name="batch" type="select" label="Manipulate a single user or multiple users">
153 <option value="false" selected="true">Single user</option>
154 <option value="true">Multiple users</option>
155 </param>
156 <when value="false">
157 <param name="user_email" type="text" label="User email" help="Specify the user email">
158 <sanitizer>
159 <valid initial="string.letters,string.digits">
160 <add value="@-=_.()/+*^,:?!"/>
161 </valid>
162 </sanitizer>
163 </param>
164 </when>
165 <when value="true">
166 <expand macro="upload_text_file" />
167 </when>
168 </conditional>
169 </when>
170 <when value="add">
171 <conditional name="batch_selector">
172 <param name="batch" type="select" label="Manipulate a single user or multiple users">
173 <option value="false" selected="true">Single user</option>
174 <option value="true">Multiple users</option>
175 </param>
176 <when value="false">
177 <param name="user_email" type="text" label="User email" help="Specify the user email">
178 <sanitizer>
179 <valid initial="string.letters,string.digits">
180 <add value="@-=_.()/+*^,:?!"/>
181 </valid>
182 </sanitizer>
183 </param>
184 <param type="text" name="group_name" size="30" value="unknown" label="Group name" />
185 </when>
186 <when value="true">
187 <expand macro="upload_text_file" />
188 </when>
189 </conditional>
190 </when>
191 <when value="remove">
192 <conditional name="batch_selector">
193 <param name="batch" type="select" label="Manipulate a single user or multiple users">
194 <option value="false" selected="true">Single user</option>
195 <option value="true">Multiple users</option>
196 </param>
197 <when value="false">
198 <param name="user_email" type="text" label="User email" help="Specify the user email">
199 <sanitizer>
200 <valid initial="string.letters,string.digits">
201 <add value="@-=_.()/+*^,:?!"/>
202 </valid>
203 </sanitizer>
204 </param>
205 <param type="text" name="group_name" size="30" value="unknown" label="Group name" />
206 </when>
207 <when value="true">
208 <expand macro="upload_text_file" />
209 </when>
210 </conditional>
211 </when>
212 </conditional>
213 </repeat>
214
215 <conditional name="advanced_options">
216 <param name="advanced_options_selector" type="select" label="Advanced options">
217 <option value="off" selected="true">Hide advanced options</option>
218 <option value="on">Display advanced options</option>
219 </param>
220 <!-- TODO: Avoid redundancy here -->
221 <when value="on">
222 <param name="port" type="integer" min="8000" max="8888" value="8080" label="Port number of Apollo" />
223 <param name="debug_mode" type="select" label="Activate debug mode">
224 <option value="false" selected="true">No</option>
225 <option value="true">Yes</option>
226 <help>
227 Use this option if you are a G-OnRamp developer
228 </help>
229 </param>
230 </when>
231 <when value="off">
232 <param name="port" type="hidden" value="8080" />
233 <param name="debug_mode" type="hidden"
234 value="false">
235 </param>
236 </when>
237 </conditional>
238 </inputs>
239 <outputs>
240 <data format="txt" name="output" label="${tool.name} on ${on_string}" />
241 </outputs>
242
243 <help>
244 This Galaxy tool is used to manage Apollo users.The currently supported operation including:
245
246 - Create a new user
247 - Delete a user
248 - Add a user to a group (If the group doesn't exist, create the group)
249 - Remove a user to a group
250
251 The tool can do these operations on one student at a time. It can also do the operations on multiple students at a time by uploading a text file, which including students information.
252
253 The text file can be either CSV (comma-delimited) or Tabular (tab-delimited). It should have a header line, including names for each column. Example text files:
254
255 Text file for creating multiple users:
256
257 .. csv-table::
258 :header: "useremail", "firstname", "lastname", "password"
259 :widths: 20, 10, 10, 10
260
261 "test1@demo.com", "test1", "demo", "1234"
262 "test2@demo.com", "test2", "demo", "1234"
263 "test3@demo.com", "test3", "demo", "1234"
264
265
266 Text file for deleting multiple users:
267
268 .. csv-table::
269 :header: "useremail"
270 :widths: 20
271
272 "test1@demo.com"
273 "test2@demo.com"
274 "test3@demo.com"
275
276
277 Text file for adding / removing multiple users from a group:
278
279 .. csv-table::
280 :header: "useremail", "group"
281 :widths: 20, 20
282
283 "test1@demo.com", "annotation_group1"
284 "test2@demo.com", "annotation_group1"
285 "test3@demo.com", "annotation_group1"
286
287 </help>
288 <citations>
289 </citations>
290 </tool>