[Checkins] SVN: Sandbox/ulif/grok-adminui-with-principals/src/grok/admin/view Added password setting functionality to usermanagement screen.

Uli Fouquet uli at gnufix.de
Sun Aug 19 18:26:19 EDT 2007


Log message for revision 79004:
  Added password setting functionality to usermanagement screen.

Changed:
  U   Sandbox/ulif/grok-adminui-with-principals/src/grok/admin/view.py
  U   Sandbox/ulif/grok-adminui-with-principals/src/grok/admin/view_templates/users.pt

-=-
Modified: Sandbox/ulif/grok-adminui-with-principals/src/grok/admin/view.py
===================================================================
--- Sandbox/ulif/grok-adminui-with-principals/src/grok/admin/view.py	2007-08-19 21:42:40 UTC (rev 79003)
+++ Sandbox/ulif/grok-adminui-with-principals/src/grok/admin/view.py	2007-08-19 22:26:19 UTC (rev 79004)
@@ -416,8 +416,11 @@
 
 
 class Users(GAIAView):
-    """Users management screen."""
+    """Users management screen.
 
+    Allows editing of principal data, adding and removing of principals.
+    """
+
     grok.name('users')
     grok.require('grok.ManageApplications')
 
@@ -451,9 +454,15 @@
                           for role in self.roles]
         return user_infos
 
+
     def getRoles(self):
+        """Get locally available roles.
+
+        Returns a list of rolename/utility tuples.
+        """
         return zope.component.getUtilitiesFor(IRole, self.context)
 
+
     def addPrincipal(self, id, login, title, description, password, roles):
         """Add a principal to the PAU.
         """
@@ -477,6 +486,7 @@
             role_manager.assignRoleToPrincipal(role, id)
         self.msg=u'Successfully added new principal `%s`.' % (title,)
 
+
     def deletePrincipal(self, id, title):
         """Delete a principal.
         """
@@ -487,10 +497,8 @@
         del self.userfolder[id[len(self.userfolder.prefix):]]
         self.msg = (u'Principal `%s` successfully deleted.' % (title,))
 
-    def setPassword(self, id, password):
-        pass
 
-    def updatePrincipal(self, id, login, title, description, roles):
+    def updatePrincipal(self, id, login, title, description, passwd, roles):
         if id is None:
             id = login
         principals = self.getPrincipals()
@@ -506,6 +514,7 @@
         principal = self.userfolder[id[len(self.userfolder.prefix):]]
         principal.title = title
         principal.description = description
+        principal.password = passwd and passwd or principal.password
         
         # Update roles...
         role_manager = IPrincipalRoleManager(self.context)
@@ -540,7 +549,7 @@
         elif setpassword is not None:
             self.setPassword(id, passwd)
         elif update is not None:
-            self.updatePrincipal(id, login, title, description, roles)
+            self.updatePrincipal(id, login, title, description, passwd, roles)
         # Determine the list of principals _after_ changing the PAU
         self.principals = self.getPrincipals()
 

Modified: Sandbox/ulif/grok-adminui-with-principals/src/grok/admin/view_templates/users.pt
===================================================================
--- Sandbox/ulif/grok-adminui-with-principals/src/grok/admin/view_templates/users.pt	2007-08-19 21:42:40 UTC (rev 79003)
+++ Sandbox/ulif/grok-adminui-with-principals/src/grok/admin/view_templates/users.pt	2007-08-19 22:26:19 UTC (rev 79004)
@@ -61,24 +61,18 @@
 		</td>
 	      </tr>
 	      <tr>
+		<td><label for="passwd" 
+			   class="menu-label1">Password:</label></td>
+		<td><input type="password" name="passwd" /></td>
+	      </tr>
+
+	      <tr>
 		<td/>
 		<td align="right">
 		  <input type="submit" name="update"
 			 value="update">
 		  </td>
 		</tr>
-		<tr>
-		  <td><label for="password" 
-			     class="menu-label1">Password:</label></td>
-		  <td><input type="password" name="password" /></td>
-		</tr>
-		<tr>
-		  <td/>
-		  <td align="right">
-		    <input type="submit" name="setpassword"
-			   value="set password" />
-		  </td>
-		</tr>
 		
 	      </table>
 	    </form>



More information about the Checkins mailing list