[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/Services/AuthenticationService/Views/Browser - EditUser.py:1.2 editUser.pt:1.2
Stephan Richter
srichter@cbu.edu
Sat, 13 Jul 2002 14:26:27 -0400
Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Services/AuthenticationService/Views/Browser
In directory cvs.zope.org:/tmp/cvs-serv32438/lib/python/Zope/App/OFS/Services/AuthenticationService/Views/Browser
Modified Files:
EditUser.py editUser.pt
Log Message:
Yes, I forgot the configure.zcml.
I also added Role support now. While it uses the global registry right now,
I am already working on a IAnnotations version. I will check that in soon.
=== Zope3/lib/python/Zope/App/OFS/Services/AuthenticationService/Views/Browser/EditUser.py 1.1 => 1.2 ===
$Id$
"""
+from Zope.ComponentArchitecture import getService
from Zope.Publisher.Browser.BrowserView import BrowserView
class EditUser(BrowserView):
@@ -26,4 +27,9 @@
user.setLogin(login)
if password != "DEFAULT":
user.setPassword(password)
+ user.setRoles(roles)
return self.request.response.redirect(self.request.URL[-1])
+
+ def getAvailableRoles(self):
+ service = getService(self.context, "RoleService")
+ return service.getRoles()
=== Zope3/lib/python/Zope/App/OFS/Services/AuthenticationService/Views/Browser/editUser.pt 1.1 => 1.2 ===
<tr>
<th>Roles:</th>
<td>
- <select name="roles:list">
- <option value="Manager">Manager</option>
+ <select name="roles:list" size="5" multiple>
+ <tal:block tal:repeat="role view/getAvailableRoles"
+ tal:define="user_roles context/getRoles">
+ <option value=""
+ tal:condition="python: role.getId() not in user_roles"
+ tal:attributes="value role/getId"
+ tal:content="role/getTitle" />
+ <option value="" selected=""
+ tal:condition="python: role.getId() in user_roles"
+ tal:attributes="value role/getId"
+ tal:content="role/getTitle" />
+ </tal:block>
</select>
</td>
</tr>
@@ -52,7 +62,7 @@
</tbody>
</table>
- <input type="submit" name="action.html:method" value="Edit" />
+ <input type="submit" name="edit.html:method" value="Edit" />
</form>