blob: 38e4fe240db163e79a24cd16a51318f19310859f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
[% INCLUDE 'admin/header.html' title=loc("User Import") -%]
[% PROCESS 'admin/report_blocks.html' %]
[% INCLUDE status_message %]
<form method="post" id="user_edit" enctype="multipart/form-data" accept-charset="utf-8">
<input type="hidden" name="token" value="[% csrf_token %]" >
<input type="hidden" name="submit" value="1" >
<p>
<label>
[% loc('CSV File') %]
<input type="file" name="csvfile" id="form_csvfile" />
</label>
<input type="submit" class="btn" name="Import users" value="[% loc('Import users') %]" />
</p>
</form>
[% IF new_users %]
<h2>[% tprintf(loc('Created %d new users'), new_users.size ) %]</h2>
<table>
<tr>
<th>[% loc('Name') %]</th>
<th>[% loc('Email') %]</th>
<th>[% loc('Body') %]</th>
</tr>
[% FOREACH user IN new_users %]
<tr>
<td>
<a href="[% c.uri_for_action( 'admin/users/edit', [ user.id ] ) %]">
[% user.name %]
</a>
</td>
<td>[% user.email %]</td>
<td>[% user.from_body.name %]</td>
</tr>
[% END %]
</table>
[% END %]
[% IF existing_users %]
<h2>[% tprintf(loc("%d users already existed"), existing_users.size) %]</h2>
<p>[% loc("These users weren't updated.") %]</p>
<table>
<tr>
<th>[% loc('Name') %]</th>
<th>[% loc('Email') %]</th>
<th>[% loc('Body') %]</th>
</tr>
[% FOREACH user IN existing_users %]
<tr>
<td>
<a href="[% c.uri_for_action( 'admin/users/edit', [ user.id ] ) %]">
[% user.name %]
</a>
</td>
<td>[% user.email %]</td>
<td>[% user.from_body.name %]</td>
</tr>
[% END %]
</table>
[% END %]
<h2>[% loc('Usage notes') %]</h2>
<p>[% loc('This page is a quick way to create many new staff users in one go.') %]</p>
<p>[% loc("Existing users won't be modified.") %]</p>
<p>
[% loc("The uploaded CSV file must contain a header row, and records can have the following fields:") %]
<pre>name,email,from_body,permissions,roles,passwordhash</pre>
<ul>
<li><code>from_body</code>: [% loc("the database id of the body to associate that user with, e.g. <code>2217</code> for Buckinghamshire.") %]</li>
<li><code>permissions</code>: [% loc("a colon-separated list of permissions to grant that user, e.g. <code>contribute_as_body:moderate:user_edit</code>.") %]</li>
<li><code>roles</code>: [% loc("a colon-separated list of roles to assign to that user.") %]</li>
</ul>
</p>
[% INCLUDE 'admin/footer.html' %]
|