Compat zope-2.12 : résolution des problèmes avec les interfaces.
[GroupUserFolder.git] / dtml / GRUF_user.zpt
1 <h1 tal:replace="structure here/manage_page_header">Header</h1>
2 <h2 tal:define="manage_tabs_message options/manage_tabs_message | nothing"
3 tal:replace="structure here/manage_tabs">Tabs</h2>
4 <tal:block tal:define="
5 global user python:here.getUser(request.username);
6 kind python:test(user.isGroup(), 'Group', 'User');
7 icon python:test(user.isGroup(), 'img_group', 'img_user');
8 color python:test(user.isGroup(), here.acl_users.group_color, here.acl_users.user_color);
9 ">
10
11 <br />
12
13 <div class="std-text">&nbsp;
14 <img src="" alt="kind" tal:attributes="src icon; alt kind" align="middle">
15 <strong tal:condition="user/isGroup" tal:content="structure string:${user/asHTML} (Group)">toto group management</strong>
16 <strong tal:condition="not: user/isGroup" tal:content="structure string:${user/asHTML} (User)">toto user management</strong>
17 </div>
18
19
20 <h4>Settings</h4>
21
22 <form action="" method="POST" tal:attributes="action here/absolute_url">
23 <tal:block tal:define="
24 label_groups python:user.getGroups();
25 label_groups_no_recurse python:user.getImmediateGroups();
26 label_groups_recurse python:filter(lambda x: x not in label_groups_no_recurse, label_groups);
27 groups_no_recurse python:map(lambda x: here.getUser(x), label_groups_no_recurse);
28 groups_recurse python:map(lambda x: here.getUser(x), label_groups_recurse);
29 roles python:filter(lambda x: x not in ('Authenticated', 'Shared'), user.getRoles());
30 roles_no_recurse python:filter(lambda x: x not in ('Authenticated', 'Shared'), user.getUserRoles());
31 roles_recurse python:filter(lambda x: x not in roles_no_recurse, roles)
32 ">
33 <ol>
34 <table cellspacing="10">
35 <tr>
36 <!-- User info -->
37 <input type="hidden" name="user" value="" tal:attributes="value user/getUserName">
38 <td valign="top">
39 <table bgcolor="#EEEEEE">
40 <tr>
41 <th class="list-header"><span tal:replace="kind" /> name</th>
42 <td class="list-item">
43 <strong tal:content="structure user/asHTML">
44 </strong>
45 </td>
46 </tr>
47 <tr>
48 <th class="list-header">Member of groups</th>
49 <td class="list-item">
50 <span tal:repeat="group groups_no_recurse" >
51 <span tal:replace="structure group/asHTML"></span><span tal:condition="not:repeat/group/end">, </span>
52 </span>
53 </td>
54 </tr>
55 <tr>
56 <th class="list-header">Implicitly member of groups</th>
57 <td class="list-item">
58 <span tal:repeat="group groups_recurse" >
59 <span tal:replace="structure python:group.asHTML(implicit=1)"></span><span tal:condition="not:repeat/group/end">, </span>
60 </span>
61 </td>
62 </tr>
63 <tr>
64 <th class="list-header">Has roles</th>
65 <td class="list-item">
66 <div class="list-item">
67 <span tal:repeat="role roles_no_recurse" >
68 <font color=""
69 tal:attributes="color here/role_color">
70 <span tal:replace="role"></span><span tal:condition="not:repeat/role/end">, </span>
71 </font>
72 </span>
73 </div>
74 </td>
75 </tr>
76 <tr>
77 <th class="list-header">Implicitly has roles (from groups)</th>
78 <td class="list-item">
79 <div class="list-item">
80 <span tal:repeat="role roles_recurse" >
81 <font color=""
82 tal:attributes="color here/role_color">
83 <i><span tal:replace="role"></span></i><span tal:condition="not:repeat/role/end">, </span>
84 </font>
85 </span>
86 </div>
87 </td>
88 </tr>
89 <tr>
90 <td colspan="4" align="center"><br>
91 <input type="submit" name="changeUser:method" value="Change" />
92 <tal:block tal:replace="nothing">
93 XXX have to make this work again
94 &nbsp;
95 <input type="submit" name="deleteUser:method" value="Delete" />
96 <br>&nbsp;
97 </tal:block>
98 </td>
99 </tr>
100 </table>
101 </td>
102
103 <td valign="middle">
104 =>
105 </td>
106
107 <td valign="top">
108 <table bgcolor="#EEEEEE">
109 <tr>
110 <td>
111 <!-- Groups selection -->
112 <table width="100%">
113 <tr class="list-header">
114 <th colspan="2">Set groups</th>
115 </tr>
116
117 <tr tal:repeat="group here/getGroups">
118 <td>
119 <input type="checkbox" name="groups:list" value="" checked=""
120 tal:condition="python: group.getUserName() != user.getUserName()"
121 tal:attributes="
122 value group/getUserName;
123 checked python:test(group.getId() in user.getGroupIds(), '1', '')">
124 </td>
125 <td>
126 <div class="list-item" tal:content="structure group/asHTML"></div>
127 </td>
128 </tr>
129 </table>
130
131 <br>
132
133 <!-- Roles selection -->
134 <table width="100%">
135 <tr class="list-header">
136 <th colspan="2">Set roles</th>
137 </tr>
138
139 <tr tal:repeat="role here/valid_roles">
140 <td tal:condition="python:role not in ('Authenticated', 'Anonymous', 'Shared')">
141 <input type="checkbox" name="roles:list" value="" checked=""
142 tal:attributes="value role; checked python:test(role in user.getUserRoles(), '1', '')">
143 </td>
144 <td tal:condition="python:role not in ('Authenticated', 'Anonymous', 'Shared')">
145 <div class="list-item"><font color="" tal:attributes="color here/role_color" tal:content="role">Role</font></div>
146 </td>
147 </tr>
148 </table>
149 </td>
150 </tr>
151 </table>
152 </ol>
153 </tal:block>
154
155 </form>
156
157
158 <tal:block tal:condition="nothing|user/isGroup">
159 XXX TODO ! XXX
160 <h4>Group contents</h4>
161 <ol>
162 <table bgcolor="#EEEEEE" tal:define="content python:list(user.getImmediateGroups())">
163 <tr class="list-header">
164 <th>Group/User</th>
165 <th class="list-header">Member <br>of groups</th>
166 <th class="list-header">Implicitly <br>member <br>of groups</th>
167 <th class="list-header">Has roles</th>
168 <th class="list-header">Implicitly <br>has roles <br>(from groups)</th>
169 </tr>
170
171 <tr
172 tal:repeat="user python:content" class="" tal:attributes="class python:test(path('repeat/user/odd'), 'row-hilite', 'row-normal')"
173 >
174 <div tal:define="
175 label_groups python:user.getGroups();
176 label_groups_no_recurse python:user.getImmediateGroups();
177 label_groups_recurse python:filter(lambda x: x not in label_groups_no_recurse, label_groups);
178 groups_no_recurse python:map(lambda x: here.getUser(x), label_groups_no_recurse);
179 groups_recurse python:map(lambda x: here.getUser(x), label_groups_recurse);
180 roles python:filter(lambda x: x not in ('Authenticated', 'Shared'), user.getRoles());
181 roles_no_recurse python:filter(lambda x: x not in ('Authenticated', 'Shared'), user.getUserRoles());
182 roles_recurse python:filter(lambda x: x not in roles_no_recurse, roles);"
183 tal:omit-tag="">
184 <td class="list-item">
185 <span tal:repeat="group groups_no_recurse" >
186 <span tal:replace="structure group/asHTML"></span><span tal:condition="not:repeat/group/end">, </span>
187 </span>
188 </td>
189 <td class="list-item">
190 <span tal:repeat="group groups_recurse" >
191 <span tal:replace="structure python:user.asHTML(implicit=1)"></span><span tal:condition="not:repeat/group/end">, </span>
192 </span>
193 </td>
194 <td class="list-item">
195 <div class="list-item">
196 <span tal:repeat="role roles_no_recurse" >
197 <font color=""
198 tal:attributes="color here/role_color">
199 <span tal:replace="role"></span><span tal:condition="not:repeat/role/end">, </span>
200 </font>
201 </span>
202 </div>
203 </td>
204 <td class="list-item">
205 <div class="list-item">
206 <span tal:repeat="role roles_recurse" >
207 <font color=""
208 tal:attributes="color here/role_color">
209 <i><span tal:replace="role"></span></i><span tal:condition="not:repeat/role/end">, </span>
210 </font>
211 </span>
212 </div>
213 </td>
214 </div>
215 </tr>
216 </table>
217 </ol>
218 </tal:block>
219
220
221 <h4>Instructions</h4>
222 <ol>
223 <p class="form-help">
224 To change roles for a <span tal:replace="kind" />,
225 select the roles you want to give it and the groups it belongs to in the forms on the right and click "Change".<br />
226 </p>
227 </ol>
228
229 <h4>Important notice / disclaimer</h4>
230
231 <ol>
232 <p class="form-help">
233 This form uses the regular Zope Security API from the underlying user folders. However, you may experience problems with some
234 of them, especially if they are not tuned to allow user adding. For example, an LDAPUserFolder can be configured to disable
235 users management. In case this form doesn't work, you'll have to do things by hand within the 'Users' and 'Groups' GRUF folders.
236 </p>
237
238 <p class="form-help">
239 This is not a GRUF limitation ! :-)
240 </p>
241 </ol>
242
243 </tal:block>
244
245 <h1 tal:replace="structure here/manage_page_footer">Footer</h1>
246
247