eggification
[GroupUserFolder.git] / Products / GroupUserFolder / dtml / GRUF_users.zpt
diff --git a/Products/GroupUserFolder/dtml/GRUF_users.zpt b/Products/GroupUserFolder/dtml/GRUF_users.zpt
new file mode 100644 (file)
index 0000000..b80223d
--- /dev/null
@@ -0,0 +1,340 @@
+    <h1 tal:replace="structure here/manage_page_header">Header</h1>
+    <h2 tal:define="manage_tabs_message options/manage_tabs_message | nothing"
+      tal:replace="structure here/manage_tabs">Tabs</h2>
+
+    <h4>Users sources</h4>
+    <ol>
+      <table cellspacing="10" width="90%" tal:define="groups here/getGroups">
+        <tr tal:repeat="source here/listUserSourceFolders">
+          <th class="list-header">Users source #<span tal:replace="repeat/source/number">1</span></th>
+          <td bgcolor="#EEEEEE" tal:condition="source/isValid"
+          tal:define="meta_type source/acl_users/meta_type|nothing;
+                      title_or_id source/acl_users/title|meta_type;">
+            <img src="" 
+           tal:attributes="src source/acl_users/icon;
+           title meta_type">
+            &nbsp;
+            <a href="" 
+           tal:attributes="
+           href string:${source/acl_users/absolute_url}/manage_workspace;
+           title meta_type" 
+           tal:content="title_or_id">Title</a>
+            <tal:block condition="not:source/isEnabled">
+              <font color="red"><i>(disabled)</i></font>
+            </tal:block>
+          </td>
+          <td bgcolor="#EEEEEE" tal:condition="not:source/isValid">
+            <font color="red"><strong><i>(invalid or broken)</i></strong></font>
+          </td>
+        </tr>
+      </table>
+    </ol>
+
+    <tal:block 
+      tal:condition="not: search_userid"
+      tal:define="global search_userid request/search_userid|nothing"
+      >
+      <tal:block tal:define="global users here/getPureUsers">
+      </tal:block>
+    </tal:block>
+    <tal:block tal:condition="search_userid">
+      <tal:block 
+        tal:define="
+        uid search_userid;
+        global users python:[ here.getUser(uid) for uid in here.searchUsersById(uid) if uid ];
+        ">
+      </tal:block>
+    </tal:block>
+    
+    <h4>Search</h4>
+    <ol>
+      <div 
+        tal:define="have_users python: len(users);">
+        <div class="list-item" tal:condition="python: not have_users and not search_userid">
+          No user available. This happens either if you have no users defined or if
+          the underlying UserFolder cannot retreive the entire users list (for example, LDAPUserFolder
+          is limited in results size).
+        </div>
+        <div class="list-item">
+          Some more users may be available but do not show up there.. This happens if
+          the underlying UserFolder cannot retreive the entire users list (for example, 
+          LDAPUserFolder is limited in results size and will return only cached users).
+        </div>
+        <div class="list-item">
+          You can search users giving part of their id with this form.
+        </div>
+        <div>
+          <form action="" tal:attributes="action template/absolute_url">
+            <b>User name:</b> 
+            <input name="search_userid" type="text" tal:attributes="value search_userid" />
+            <input type="submit" value="Search" />
+          </form>
+        </div>
+      </div>
+    </ol>
+
+    <h4 tal:condition="not: search_userid">Users management</h4>
+    <h4 tal:condition="search_userid">Search results</h4>
+    <form action="" method="POST" tal:attributes="action request/URL1">
+      <ol>
+        <div tal:condition="python: not users and search_userid">
+          No user found.
+        </div>
+        <table cellspacing="10" width="90%">
+          <tr>
+            <!-- Users selection -->
+            <td valign="top">
+              <table bgcolor="#EEEEEE" width="100%">
+                <tr class="list-header" tal:condition="users">
+                  <th>&nbsp;</th>
+                  <th>User</th>
+                  <th class="list-header">Member <br>of groups</th>
+                  <th class="list-header">Implicitly <br>member of*</th>
+                  <th class="list-header">Has roles</th>
+                  <th class="list-header">Implicitly <br>has roles**</th>
+                </tr>
+                
+                <tr 
+                  tal:repeat="user users"
+                  class="" 
+                  tal:attributes="class python:test(path('repeat/user/odd'), 'row-hilite', 'row-normal')"
+                  >
+                  <div tal:condition="user"
+                    tal:omit-tag=""
+                    x:comment="We ignore empty/invalid users"
+                    >
+                    <div tal:define="
+                      label_groups python:user.getGroups();
+                      label_groups_no_recurse python:user.getGroups(no_recurse = 1);
+                      label_groups_recurse python:filter(lambda x: x not in label_groups_no_recurse, label_groups);
+                      groups_no_recurse python:map(lambda x: here.getUser(x), label_groups_no_recurse);
+                      groups_recurse python:map(lambda x: here.getUser(x), label_groups_recurse);
+                      roles python:filter(lambda x: x not in ('Authenticated', 'Shared'), user.getRoles());
+                      roles_no_recurse python:filter(lambda x: x not in ('Authenticated', 'Shared'), user.getUserRoles());
+                      roles_recurse python:filter(lambda x: x not in roles_no_recurse, roles);"
+                      tal:omit-tag="">
+                      <td><div class="list-item"><input type="checkbox" name="users:list" value="" tal:attributes="value user"></td>
+                      <td>
+                        <div class="list-item">
+                          <img src="img_user" />
+                          <strong tal:content="structure user/asHTML">
+                          </strong>
+                      </td>
+                      <td class="list-item">
+                        <span tal:repeat="group groups_no_recurse" >
+                          <span tal:replace="structure group/asHTML"></span><span tal:condition="not:repeat/group/end">, </span>
+                        </span>
+                      </td>
+                      <td class="list-item">
+                        <span tal:repeat="group groups_recurse" >
+                          <span tal:replace="structure python:group.asHTML(implicit=1)"></span><span tal:condition="not:repeat/group/end">, </span>
+                        </span>
+                      </td>
+                      <td class="list-item">
+                        <div class="list-item">
+                          <span tal:repeat="role roles_no_recurse" >
+                            <font color=""
+                              tal:attributes="color here/role_color">
+                              <span tal:replace="role"></span><span tal:condition="not:repeat/role/end">, </span>
+                            </font>
+                          </span>
+                        </div>
+                      </td>
+                      <td class="list-item">
+                        <div class="list-item">
+                          <span tal:repeat="role roles_recurse" >
+                            <font color=""
+                              tal:attributes="color here/role_color">
+                              <i><span tal:replace="role"></span></i><span tal:condition="not:repeat/role/end">, </span>
+                            </font>
+                          </span>
+                        </div>
+                      </td>
+                    </div>
+                  </div>
+                </tr>
+                <tr>
+                  <td colspan="5">
+                    <input type="submit" name="deleteUsers:method" value="Delete" /><br />
+                    You can also change group / roles with the form below.
+                  </td>
+                </tr>
+              </table>
+
+
+              <div tal:condition="python: not search_userid"
+                tal:define="have_users python: len(users);">
+                <div class="list-item" tal:condition="not: have_users">
+                  No user available. This happens either if you have no users defined or if
+                  the underlying UserFolder cannot retreive the entire users list (for example, LDAPUserFolder
+                  is limited in results size).<br />
+                  Use the above search form to search for specific users.
+                </div>
+              </div>
+      </ol>
+
+      <!-- New user -->
+      <h4>User creation</h4>
+      <ol>
+        <table>
+          <tr>
+            <td><div class="list-item">&nbsp;</div></td>
+            <td>
+              <div class="list-item">Batch user creation list:</div>
+            </td>
+          </tr>
+          <tr>
+            <td><div class="list-item">&nbsp;</div></td>
+            <td>
+              <div class="list-item">
+                <textarea name="new_users:lines" cols="20" rows="3"></textarea>
+              </div>
+            </td>
+            <td colspan="4">
+              <div class="list-item" valign="top">
+                Newly created users will be affected groups and roles according to the table below.
+              </div>
+            </td>
+          </tr>
+          <tr>
+            <td><div class="list-item">&nbsp;</div></td>
+            <td>
+              <div class="list-item">Default password:</div>
+            </td>
+          </tr>
+          <tr>
+            <td><div class="list-item">&nbsp;</div></td>
+            <td>
+              <div class="list-item">
+                <input name="default_password:string" size="20" />
+              </div>
+            </td>
+            <td colspan="4">
+              <div class="list-item">
+                Fill in this field to specify a default password for new users, 
+                or leave it empty to let GRUF generate random ones.
+              </div>
+            </td>
+          </tr>
+          <tr>
+            <td colspan="2" align="center">
+              <input type="submit" name="changeOrCreateUsers:method" value="Create" />
+            </td>
+          </tr>
+        </table>
+      </ol>
+      
+
+      <h4>Roles / groups management</h4>
+      <ol>
+      <table>
+        <tr>
+          <td align="center">
+            <div class="list-item">
+              Select one or more users in the upper table, select one or more groups / roles in the table below
+              and click "Change" to affect groups / roles to these users.
+            </div>
+          </td>
+        </tr>
+        <tr>
+          <td valign="top" align="center" colspan="6">
+            <table  bgcolor="#EEEEEE">
+              <tr>
+                <td valign="top">
+                  <!-- Groups selection -->
+                  <table width="100%">
+                    <tr class="list-header">
+                      <th colspan="2">Affect groups</th>
+                    </tr>
+                    
+                    <tr tal:repeat="group here/getGroups">
+                      <td>
+                        <input type="checkbox" name="groups:list" value="" tal:attributes="value group">
+                      </td>
+                      <td>
+                        <div class="list-item" tal:content="structure group/asHTML"></div>
+                      </td>
+                    </tr>
+                    
+                    <!-- "(None)" item -->
+                    <tr>
+                      <td><div class="list-item"><input type="checkbox" name="nested_groups:list" value="__None__"></div></td>
+                      <td><div class="list-item"><i>(None)</i></div></td>
+                    </tr>
+                  </table>
+                </td>
+                <td valign="top">
+                  <!-- Roles selection -->
+                  <table width="100%">
+                    <tr class="list-header">
+                      <th colspan="2">Affect roles</th>
+                    </tr>
+                    
+                    <tr tal:repeat="role here/valid_roles">
+                      <td tal:condition="python:role not in ('Authenticated', 'Anonymous', 'Shared')">
+                        <input type="checkbox" name="roles:list" value="" tal:attributes="value role">
+                      </td>
+                      <td tal:condition="python:role not in ('Authenticated', 'Anonymous', 'Shared')">
+                        <div class="list-item"><font color="" tal:attributes="color here/role_color" tal:content="role">Role</font></div>
+                      </td>
+                    </tr>
+                    
+                    <!-- "(None)" item -->
+                    <tr>
+                      <td><div class="list-item"><input type="checkbox" name="roles:list" value="__None__"></div></td>
+                      <td><div class="list-item"><i>(None)</i></div></td>
+                    </tr>
+                  </table>
+                </td>
+              </tr>
+              <tr>
+                <td colspan="2" align="middle"><input type="submit" name="changeOrCreateUsers:method" value="Change" /></td>
+            </table>
+          </td>
+        </tr>
+      </table>
+
+      <p class="form-help">
+        If you do not select a role, roles won't be reset for the selected users.<br />
+        If you do not select a group, groups won't be reset for the selected users.<br />
+        To explicitly reset groups or roles, just click the "(None)" entry (and no other entry).
+      </p>
+
+      <p class="form-help">
+        * According to the groups inheritance, this group is also recursively member of these groups. <br />This is what we call nested groups.
+      </p>
+      <p class="form-help">
+        ** Accorded to the groups inheritance, this group also has these roles - even if they are not defined explicitly on it.
+      </p>
+
+    </ol>
+    </form>
+
+
+    <h4>Instructions</h4>
+    <ol>
+        <p class="form-help">
+          To change roles for one or several users, select them in the left form, 
+          select the roles you want to give them and the groups they belong to in the forms on the right and click "Change".<br />
+          You can also create one or several users by filling the text area (one user per line). 
+          The "Change" button will create them with the roles and group affectation you've selected. 
+          A random password will be generated for them, and it will be shown in a page so that you can click/paste them somewhere.<br />
+          If you want to kill some users, you can delete them by selecting them and clicking the "Delete" button.
+        </p>
+    </ol>
+
+    <h4>Important notice / disclaimer</h4>
+    
+    <ol>
+        <p class="form-help">
+          This form uses the regular Zope Security API from the underlying user folders. However, you may experience problems with some
+          of them, especially if they are not tuned to allow user adding. For example, an LDAPUserFolder can be configured to disable
+          users management. In case this form doesn't work, you'll have to do things by hand within the 'Users' and 'Groups' GRUF folders.
+        </p>
+
+        <p class="form-help">
+          This is not a GRUF limitation ! :-)
+        </p>
+    </ol>
+
+    <h1 tal:replace="structure here/manage_page_footer">Footer</h1>