[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/pas/ Fix ZCML.
Stephan Richter
srichter at cosmos.phy.tufts.edu
Mon Oct 11 05:54:23 EDT 2004
Log message for revision 27949:
Fix ZCML.
Added Principal Addition View.
Changed:
A Zope3/trunk/src/zope/app/pas/browser/
A Zope3/trunk/src/zope/app/pas/browser/__init__.py
A Zope3/trunk/src/zope/app/pas/browser/configure.zcml
A Zope3/trunk/src/zope/app/pas/browser/zodb.py
A Zope3/trunk/src/zope/app/pas/browser/zodb_overview.pt
U Zope3/trunk/src/zope/app/pas/configure.zcml
U Zope3/trunk/src/zope/app/pas/principalplugins.zcml
U Zope3/trunk/src/zope/app/pas/zodb.py
-=-
Added: Zope3/trunk/src/zope/app/pas/browser/__init__.py
===================================================================
--- Zope3/trunk/src/zope/app/pas/browser/__init__.py 2004-10-11 09:49:43 UTC (rev 27948)
+++ Zope3/trunk/src/zope/app/pas/browser/__init__.py 2004-10-11 09:54:22 UTC (rev 27949)
@@ -0,0 +1 @@
+# Make a package
Added: Zope3/trunk/src/zope/app/pas/browser/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/pas/browser/configure.zcml 2004-10-11 09:49:43 UTC (rev 27948)
+++ Zope3/trunk/src/zope/app/pas/browser/configure.zcml 2004-10-11 09:54:22 UTC (rev 27949)
@@ -0,0 +1,17 @@
+<zope:configure
+ xmlns:zope="http://namespaces.zope.org/zope"
+ xmlns="http://namespaces.zope.org/browser">
+
+ <pages
+ permission="zope.ManageServices"
+ for="..zodb.IPersistentPrincipalStorage"
+ class=".zodb.PrincipalManagement">
+
+ <page name="editForm.html" template="zodb_overview.pt"
+ menu="zmi_views" title="Managament" />
+ <page name="add.html" attribute="add" />
+ <page name="delete.html" attribute="delete" />
+
+ </pages>
+
+</zope:configure>
Added: Zope3/trunk/src/zope/app/pas/browser/zodb.py
===================================================================
--- Zope3/trunk/src/zope/app/pas/browser/zodb.py 2004-10-11 09:49:43 UTC (rev 27948)
+++ Zope3/trunk/src/zope/app/pas/browser/zodb.py 2004-10-11 09:54:22 UTC (rev 27949)
@@ -0,0 +1,39 @@
+##############################################################################
+#
+# Copyright (c) 2004 Zope Corporation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+"""Persistent Principal Storage and Authentication Plugin Views
+
+$Id$
+"""
+__docformat__ = "reStructuredText"
+
+
+class PrincipalManagement(object):
+ """ """
+
+ def add(self, login, password):
+ if len(self.context) >= 1:
+ id = max(self.context.keys())+1
+ else:
+ id = 1
+ self.context[id] = (login, password)
+ self.request.response.redirect('@@editForm.html')
+
+ def delete(self, ids):
+ for id in ids:
+ del self.context[int(id)]
+ self.request.response.redirect('@@editForm.html')
+
+ def list(self):
+ return [{'id': id, 'login': principal[0]}
+ for id, principal in self.context.items()]
Added: Zope3/trunk/src/zope/app/pas/browser/zodb_overview.pt
===================================================================
--- Zope3/trunk/src/zope/app/pas/browser/zodb_overview.pt 2004-10-11 09:49:43 UTC (rev 27948)
+++ Zope3/trunk/src/zope/app/pas/browser/zodb_overview.pt 2004-10-11 09:54:22 UTC (rev 27949)
@@ -0,0 +1,60 @@
+<html metal:use-macro="context/@@standard_macros/page">
+<head>
+ <title metal:fill-slot="title" i18n:translate="">
+ Translation Service - Translate
+ </title>
+</head>
+
+<body>
+<div metal:fill-slot="body">
+
+ <h3>List of Principals</h3>
+ <form action="@@delete.html" method="post">
+ <br />
+ <table border="1" width="100%">
+ <tr>
+ <th width="16"> </th>
+ <th i18n:translate="">Principal Id</th>
+ <th i18n:translate="">Principal Login</th>
+ </tr>
+ <tr tal:repeat="principal view/list">
+ <td>
+ <input type="checkbox" name="ids:list" value=""
+ tal:attributes="value principal/id" />
+ </td>
+ <td tal:content="principal/id">1</td>
+ <td tal:content="principal/login">srichter</td>
+ </tr>
+ </table>
+ <br />
+ <input class="form-element" type="submit" name="SUBMIT_DELETE"
+ value="Delete" i18n:attributes="value" />
+ </form>
+
+ <h3>New Principal</h3>
+ <form action="@@add.html" method="post">
+
+ <div class="row">
+ <div class="label" i18n:translate="">Login</div>
+ <div class="field">
+ <input type="text" name="login"/>
+ </div>
+ </div>
+
+ <div class="row">
+ <div class="label" i18n:translate="">Password</div>
+ <div class="field">
+ <input type="password" name="password"/>
+ </div>
+ </div>
+
+ <div class="row">
+ <input class="form-element" type="submit"
+ name="SUBMIT_ADD" value="Add" i18n:attributes="value" />
+ </div>
+
+ </form>
+
+</div>
+</body>
+</html>
Modified: Zope3/trunk/src/zope/app/pas/configure.zcml
===================================================================
--- Zope3/trunk/src/zope/app/pas/configure.zcml 2004-10-11 09:49:43 UTC (rev 27948)
+++ Zope3/trunk/src/zope/app/pas/configure.zcml 2004-10-11 09:54:22 UTC (rev 27949)
@@ -69,5 +69,7 @@
<include file="challengeplugins.zcml" />
<include file="principalplugins.zcml" />
<include file="authenticationplugins.zcml" />
+
+ <include package=".browser" />
</configure>
Modified: Zope3/trunk/src/zope/app/pas/principalplugins.zcml
===================================================================
--- Zope3/trunk/src/zope/app/pas/principalplugins.zcml 2004-10-11 09:49:43 UTC (rev 27948)
+++ Zope3/trunk/src/zope/app/pas/principalplugins.zcml 2004-10-11 09:54:22 UTC (rev 27949)
@@ -4,7 +4,7 @@
i18n_domain="zope"
>
- <localUtility class=".principalplugin.PrincipalFactory">
+ <localUtility class=".principalplugins.PrincipalFactory">
<implements
interface="zope.app.annotation.interfaces.IAttributeAnnotatable" />
@@ -19,7 +19,7 @@
<browser:addMenuItem
title="PAS Principal Factory Plugin"
description="A PAS Principal Factory Plugin"
- class=".principalplugin.PrincipalFactory"
+ class=".principalplugins.PrincipalFactory"
permission="zope.ManageContent"
/>
Modified: Zope3/trunk/src/zope/app/pas/zodb.py
===================================================================
--- Zope3/trunk/src/zope/app/pas/zodb.py 2004-10-11 09:49:43 UTC (rev 27948)
+++ Zope3/trunk/src/zope/app/pas/zodb.py 2004-10-11 09:54:22 UTC (rev 27949)
@@ -28,6 +28,9 @@
import interfaces
+class IPersistentPrincipalStorage(IContainer):
+ """Marker Interface"""
+
class PersistentPrincipalStorage(Persistent, Contained):
"""A Persistent Principal Storage and Authentication plugin
@@ -35,7 +38,7 @@
form (login, password). Since we try not to expose the password, password
is always `None` in any output.
"""
- implements(interfaces.IAuthenticationPlugin, IContainer)
+ implements(interfaces.IAuthenticationPlugin, IPersistentPrincipalStorage)
def __init__(self):
self._principal_by_id = IOBTree()
More information about the Zope3-Checkins
mailing list