[Checkins]
SVN: Sandbox/ulif/grok-adminui-with-principals/src/grok/admin/view
Deleting of principals in the PAU.
Uli Fouquet
uli at gnufix.de
Sun Aug 19 12:14:50 EDT 2007
Log message for revision 78998:
Deleting of principals in the PAU.
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 15:20:02 UTC (rev 78997)
+++ Sandbox/ulif/grok-adminui-with-principals/src/grok/admin/view.py 2007-08-19 16:14:49 UTC (rev 78998)
@@ -436,8 +436,6 @@
The PAU asked is the one setup with the admin-UI.
"""
- from grok.admin import AUTH_FOLDERNAME, USERFOLDER_NAME
-
self.userfolder = self.getUserFolder()
users = list(self.userfolder.search({'search':''}))
user_infos = [self.userfolder.principalInfo(x) for x in users]
@@ -458,6 +456,8 @@
def addPrincipal(self, id, login, title, description, password, roles):
"""Add a principal to the PAU.
"""
+ if id is None:
+ id = login
principals = self.getPrincipals()
if login in [x.login for x in principals]:
self.msg = (u'Login `%s` already exists.' % (login,))
@@ -475,6 +475,16 @@
role_manager.assignRoleToPrincipal(role, id)
self.msg=u'Successfully added new principal `%s`.' % (title,)
+ def deletePrincipal(self, id, title):
+ """Delete a principal.
+ """
+ if id not in [x.id for x in self.getPrincipals()]:
+ self.msg = (u'Principal `%s` does not exist in this context.' %
+ (title,))
+ return
+ del self.userfolder[id[len(self.userfolder.prefix):]]
+ self.msg = (u'Principal `%s` successfully deleted.' % (title,))
+
def setPassword(self, id, password):
pass
@@ -482,8 +492,8 @@
pass
def update(self, id=None, login=None, title=None, description=None,
- passwd=None, roles=[], addprincipal=None, setpassword=None,
- update=None):
+ passwd=None, roles=[], addprincipal=None, delprincipal=None,
+ setpassword=None, update=None):
self.userfolder = self.getUserFolder()
if self.userfolder is None:
self.msg = ("This usermanagement screen is disabled because no "
@@ -496,6 +506,8 @@
self.roles = [name for name, util in self.getRoles()]
if addprincipal is not None:
self.addPrincipal(id, login, title, description, passwd, roles)
+ elif delprincipal is not None:
+ self.deletePrincipal(id, title)
elif setpassword is not None:
self.setPassword(id, passwd)
elif update is not None:
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 15:20:02 UTC (rev 78997)
+++ Sandbox/ulif/grok-adminui-with-principals/src/grok/admin/view_templates/users.pt 2007-08-19 16:14:49 UTC (rev 78998)
@@ -23,7 +23,7 @@
<table>
<tr tal:condition="python: principal.title != 'Manager'">
<td colspan="2">
- <input type="submit" name="deleteuser"
+ <input type="submit" name="delprincipal"
value="Delete this user" />
</td>
</tr>
@@ -91,12 +91,6 @@
<fieldset class="menu-box2">
<table>
<tr>
- <td><label for="login">Id:</label></td>
- <td><input type="text" name="id" />
- </td>
- </tr>
-
- <tr>
<td><label for="login">Login:</label></td>
<td><input type="text" name="login" />
</td>
More information about the Checkins
mailing list