[Checkins] SVN: z3ext.principals/ initial import
Nikolay Kim
fafhrd at datacom.kz
Tue Mar 25 08:43:24 EDT 2008
Log message for revision 84926:
initial import
Changed:
A z3ext.principals/
A z3ext.principals/branches/
A z3ext.principals/tags/
A z3ext.principals/trunk/
A z3ext.principals/trunk/AUTHOR.txt
A z3ext.principals/trunk/CHANGES.txt
A z3ext.principals/trunk/LICENSE.txt
A z3ext.principals/trunk/setup.py
A z3ext.principals/trunk/src/
A z3ext.principals/trunk/src/z3ext/
A z3ext.principals/trunk/src/z3ext/__init__.py
A z3ext.principals/trunk/src/z3ext/principals/
A z3ext.principals/trunk/src/z3ext/principals/__init__.py
A z3ext.principals/trunk/src/z3ext/principals/breadcrumb.py
A z3ext.principals/trunk/src/z3ext/principals/browser.zcml
A z3ext.principals/trunk/src/z3ext/principals/configure.zcml
A z3ext.principals/trunk/src/z3ext/principals/group.gif
A z3ext.principals/trunk/src/z3ext/principals/i18n.py
A z3ext.principals/trunk/src/z3ext/principals/information.pt
A z3ext.principals/trunk/src/z3ext/principals/interfaces.py
A z3ext.principals/trunk/src/z3ext/principals/layout.pt
A z3ext.principals/trunk/src/z3ext/principals/layoutpage.pt
A z3ext.principals/trunk/src/z3ext/principals/management.pt
A z3ext.principals/trunk/src/z3ext/principals/management.py
A z3ext.principals/trunk/src/z3ext/principals/newprincipal.gif
A z3ext.principals/trunk/src/z3ext/principals/system-users.png
-=-
Added: z3ext.principals/trunk/AUTHOR.txt
===================================================================
--- z3ext.principals/trunk/AUTHOR.txt (rev 0)
+++ z3ext.principals/trunk/AUTHOR.txt 2008-03-25 12:43:23 UTC (rev 84926)
@@ -0,0 +1 @@
+Nikolay Kim (fafhrd91 <at> gmail <dot> com)
Added: z3ext.principals/trunk/CHANGES.txt
===================================================================
--- z3ext.principals/trunk/CHANGES.txt (rev 0)
+++ z3ext.principals/trunk/CHANGES.txt 2008-03-25 12:43:23 UTC (rev 84926)
@@ -0,0 +1,33 @@
+=======
+CHANGES
+=======
+
+1.0.0 (2008-03-??)
+------------------
+
+- Code cleanup
+
+- Code moved to svn.zope.org
+
+
+0.11.2 (2008-02-28)
+-------------------
+
+- Use z3c.autoinclude
+
+
+0.11.1 (2008-02-20)
+-------------------
+
+- Code cleanup
+
+
+0.11 (2008-02-04)
+------------------
+
+- Added 'remove principal'
+
+0.10 (2008-02-01)
+------------------
+
+- Initial release.
Added: z3ext.principals/trunk/LICENSE.txt
===================================================================
--- z3ext.principals/trunk/LICENSE.txt (rev 0)
+++ z3ext.principals/trunk/LICENSE.txt 2008-03-25 12:43:23 UTC (rev 84926)
@@ -0,0 +1,54 @@
+Zope Public License (ZPL) Version 2.1
+-------------------------------------
+
+A copyright notice accompanies this license document that
+identifies the copyright holders.
+
+This license has been certified as open source. It has also
+been designated as GPL compatible by the Free Software
+Foundation (FSF).
+
+Redistribution and use in source and binary forms, with or
+without modification, are permitted provided that the
+following conditions are met:
+
+1. Redistributions in source code must retain the
+ accompanying copyright notice, this list of conditions,
+ and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the accompanying
+ copyright notice, this list of conditions, and the
+ following disclaimer in the documentation and/or other
+ materials provided with the distribution.
+
+3. Names of the copyright holders must not be used to
+ endorse or promote products derived from this software
+ without prior written permission from the copyright
+ holders.
+
+4. The right to distribute this software or to use it for
+ any purpose does not give you the right to use
+ Servicemarks (sm) or Trademarks (tm) of the copyright
+ holders. Use of them is covered by separate agreement
+ with the copyright holders.
+
+5. If any files are modified, you must cause the modified
+ files to carry prominent notices stating that you changed
+ the files and the date of any change.
+
+Disclaimer
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS''
+ AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT
+ NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
+ NO EVENT SHALL THE COPYRIGHT HOLDERS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGE.
Added: z3ext.principals/trunk/setup.py
===================================================================
--- z3ext.principals/trunk/setup.py (rev 0)
+++ z3ext.principals/trunk/setup.py 2008-03-25 12:43:23 UTC (rev 84926)
@@ -0,0 +1,71 @@
+##############################################################################
+#
+# Copyright (c) 2008 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.
+#
+##############################################################################
+"""Setup for z3ext.principals package
+
+$Id$
+"""
+import sys, os
+from setuptools import setup, find_packages
+
+def read(*rnames):
+ return open(os.path.join(os.path.dirname(__file__), *rnames)).read()
+
+version='1.0.0dev'
+
+
+setup(name = 'z3ext.principals',
+ version = version,
+ author = 'Nikolay Kim',
+ author_email = 'fafhrd91 at gmail.com',
+ description = "Principals management configlet for z3ext.",
+ long_description = (
+ 'Detailed Documentation\n' +
+ '======================\n'
+ + '\n\n' +
+ read('CHANGES.txt')
+ ),
+ classifiers=[
+ 'Development Status :: 5 - Production/Stable',
+ 'Environment :: Web Environment',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: Zope Public License',
+ 'Programming Language :: Python',
+ 'Natural Language :: English',
+ 'Operating System :: OS Independent',
+ 'Topic :: Internet :: WWW/HTTP',
+ 'Framework :: Zope3'],
+ url='http://z3ext.net/',
+ license='ZPL 2.1',
+ packages=find_packages('src'),
+ package_dir = {'':'src'},
+ namespace_packages=['z3ext'],
+ install_requires = ['setuptools',
+ 'zope.component',
+ 'zope.interface',
+ 'zope.schema',
+ 'zope.viewlet',
+ 'zope.contentprovider',
+ 'zope.i18nmessageid',
+ 'zope.app.form',
+ 'zope.app.security',
+ 'z3c.traverser',
+ 'z3c.autoinclude',
+ 'z3ext.layout',
+ 'z3ext.preferences',
+ 'z3ext.controlpanel',
+ 'z3ext.statusmessage',
+ ],
+ include_package_data = True,
+ zip_safe = False
+ )
Property changes on: z3ext.principals/trunk/setup.py
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:keywords
+ Id
Added: z3ext.principals/trunk/src/z3ext/__init__.py
===================================================================
--- z3ext.principals/trunk/src/z3ext/__init__.py (rev 0)
+++ z3ext.principals/trunk/src/z3ext/__init__.py 2008-03-25 12:43:23 UTC (rev 84926)
@@ -0,0 +1,6 @@
+# namespace package boilerplate
+try:
+ __import__('pkg_resources').declare_namespace(__name__)
+except ImportError, e:
+ from pkgutil import extend_path
+ __path__ = extend_path(__path__, __name__)
Property changes on: z3ext.principals/trunk/src/z3ext/__init__.py
___________________________________________________________________
Name: svn:keywords
+ Id
Added: z3ext.principals/trunk/src/z3ext/principals/__init__.py
===================================================================
--- z3ext.principals/trunk/src/z3ext/principals/__init__.py (rev 0)
+++ z3ext.principals/trunk/src/z3ext/principals/__init__.py 2008-03-25 12:43:23 UTC (rev 84926)
@@ -0,0 +1 @@
+# This file is necessary to make this directory a package.
Property changes on: z3ext.principals/trunk/src/z3ext/principals/__init__.py
___________________________________________________________________
Name: svn:keywords
+ Id
Added: z3ext.principals/trunk/src/z3ext/principals/breadcrumb.py
===================================================================
--- z3ext.principals/trunk/src/z3ext/principals/breadcrumb.py (rev 0)
+++ z3ext.principals/trunk/src/z3ext/principals/breadcrumb.py 2008-03-25 12:43:23 UTC (rev 84926)
@@ -0,0 +1,28 @@
+##############################################################################
+#
+# Copyright (c) 2007 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.
+#
+##############################################################################
+""" custom IBreadcrumb implementation for IConfiglet
+
+$Id$
+"""
+from zope import component, interface
+from z3c.breadcrumb.browser import GenericBreadcrumb
+
+from i18n import _
+from interfaces import IPrincipalsManagement
+
+
+class ManagementBreadcrumb(GenericBreadcrumb):
+ component.adapts(IPrincipalsManagement, interface.Interface)
+
+ name = _('Principals')
Property changes on: z3ext.principals/trunk/src/z3ext/principals/breadcrumb.py
___________________________________________________________________
Name: svn:keywords
+ Id
Added: z3ext.principals/trunk/src/z3ext/principals/browser.zcml
===================================================================
--- z3ext.principals/trunk/src/z3ext/principals/browser.zcml (rev 0)
+++ z3ext.principals/trunk/src/z3ext/principals/browser.zcml 2008-03-25 12:43:23 UTC (rev 84926)
@@ -0,0 +1,53 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:zcml="http://namespaces.zope.org/zcml"
+ xmlns:z3ext="http://namespaces.zope.org/z3ext"
+ xmlns:browser="http://namespaces.zope.org/browser"
+ i18n_domain="z3ext">
+
+ <browser:icon
+ name="zmi_icon"
+ for=".interfaces.IPrincipalType"
+ file="newprincipal.gif" />
+
+ <browser:icon
+ name="zmi_icon"
+ for=".interfaces.IPrincipalsManagement"
+ file="system-users.png" />
+
+ <browser:defaultView
+ name="index.html"
+ for=".interfaces.IPrincipalsManagement" />
+
+ <z3ext:layout
+ name="workspace"
+ layout="portal"
+ template="layout.pt"
+ for=".interfaces.IPrincipalPreferences" />
+
+ <z3ext:layout
+ name="workspace"
+ layout="portal"
+ template="layoutpage.pt"
+ for=".interfaces.IPrincipalsManagement" />
+
+ <z3ext:pagelet
+ name="index.html"
+ for=".interfaces.IPrincipalsManagement"
+ template="management.pt"
+ class=".management.ManagementView"
+ permission="z3ext.ManagePrincipals" />
+
+ <!-- principal infomration -->
+ <browser:viewletManager
+ name="z3ext.principals-information"
+ provides=".interfaces.IPrincipalInformation"
+ template="information.pt"
+ permission="zope.Public" />
+
+ <!-- configlet breadcrumb -->
+ <adapter
+ zcml:condition="installed z3c.breadcrumb"
+ factory=".breadcrumb.ManagementBreadcrumb" />
+
+</configure>
Added: z3ext.principals/trunk/src/z3ext/principals/configure.zcml
===================================================================
--- z3ext.principals/trunk/src/z3ext/principals/configure.zcml (rev 0)
+++ z3ext.principals/trunk/src/z3ext/principals/configure.zcml 2008-03-25 12:43:23 UTC (rev 84926)
@@ -0,0 +1,31 @@
+<configure
+ xmlns="http://namespaces.zope.org/zope"
+ xmlns:z3ext="http://namespaces.zope.org/z3ext"
+ i18n_domain="z3ext">
+
+ <autoinclude package="z3ext.principals" />
+
+ <permission
+ id="z3ext.ManagePrincipals"
+ title="Manage site principals" />
+
+ <!-- principals management configlet -->
+ <z3ext:configlet
+ name="pmanagement"
+ schema=".interfaces.IPrincipalsManagement"
+ title="Portal principals management"
+ description="Portal principals management panel."
+ permission="z3ext.ManagePrincipals" />
+
+ <adapter
+ for=".interfaces.IPrincipalsManagement *"
+ factory="z3c.traverser.traverser.PluggableTraverser"
+ provides="zope.publisher.interfaces.IPublishTraverse" />
+
+ <subscriber
+ provides="z3c.traverser.interfaces.ITraverserPlugin"
+ factory=".management.TraverserPlugin" />
+
+ <include file="browser.zcml" />
+
+</configure>
Added: z3ext.principals/trunk/src/z3ext/principals/group.gif
===================================================================
(Binary files differ)
Property changes on: z3ext.principals/trunk/src/z3ext/principals/group.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: z3ext.principals/trunk/src/z3ext/principals/i18n.py
===================================================================
--- z3ext.principals/trunk/src/z3ext/principals/i18n.py (rev 0)
+++ z3ext.principals/trunk/src/z3ext/principals/i18n.py 2008-03-25 12:43:23 UTC (rev 84926)
@@ -0,0 +1,19 @@
+##############################################################################
+#
+# Copyright (c) 2007 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.
+#
+##############################################################################
+""" i18n
+
+$Id$
+"""
+from zope.i18nmessageid import MessageFactory
+_ = MessageFactory('z3ext')
Property changes on: z3ext.principals/trunk/src/z3ext/principals/i18n.py
___________________________________________________________________
Name: svn:keywords
+ Id
Added: z3ext.principals/trunk/src/z3ext/principals/information.pt
===================================================================
--- z3ext.principals/trunk/src/z3ext/principals/information.pt (rev 0)
+++ z3ext.principals/trunk/src/z3ext/principals/information.pt 2008-03-25 12:43:23 UTC (rev 84926)
@@ -0,0 +1,8 @@
+<h1><a tal:content="context/__principal__/title"
+ tal:attributes="href string:${context/@@absolute_url}/"></a></h1>
+<div class="pageDescription" tal:content="context/__principal__/description"> </div>
+<br />
+<div class="topframe">
+ <tal:block tal:repeat="viewlet options/viewlets"
+ tal:content="structure viewlet" />
+</div>
Added: z3ext.principals/trunk/src/z3ext/principals/interfaces.py
===================================================================
--- z3ext.principals/trunk/src/z3ext/principals/interfaces.py (rev 0)
+++ z3ext.principals/trunk/src/z3ext/principals/interfaces.py 2008-03-25 12:43:23 UTC (rev 84926)
@@ -0,0 +1,48 @@
+##############################################################################
+#
+# Copyright (c) 2007 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.
+#
+##############################################################################
+""" z3ext.principals interfaces
+
+$Id$
+"""
+from zope import interface
+from zope.viewlet.interfaces import IViewletManager
+
+
+class IPrincipalType(interface.Interface):
+ """ principal content type """
+
+
+class IPrincipalsManagement(interface.Interface):
+ """ princiapals management """
+
+
+class IPrincipalPreferences(interface.Interface):
+ """ marker interface for preferences """
+
+
+class IPrincipalFactory(interface.Interface):
+ """ principal factory """
+
+ name = interface.Attribute('Name')
+
+ title = interface.Attribute('Title')
+
+ description = interface.Attribute('Description')
+
+ def __init__(context, request):
+ """ adapter factory """
+
+
+class IPrincipalInformation(IViewletManager):
+ """ extra preferences viewlet manager """
Property changes on: z3ext.principals/trunk/src/z3ext/principals/interfaces.py
___________________________________________________________________
Name: svn:keywords
+ Id
Added: z3ext.principals/trunk/src/z3ext/principals/layout.pt
===================================================================
--- z3ext.principals/trunk/src/z3ext/principals/layout.pt (rev 0)
+++ z3ext.principals/trunk/src/z3ext/principals/layout.pt 2008-03-25 12:43:23 UTC (rev 84926)
@@ -0,0 +1,30 @@
+<div id="z-portal-workspace" i18n:domain="">
+ <div class="page"
+ tal:define="rendered view/render;
+ oldcontext nocall:context;
+ context nocall:layoutcontext;
+ userinfo provider:z3ext.principals-information;
+ context nocall:oldcontext;
+ navigation maincontext/@@navigation;
+ noInfo python:not userinfo and not navigation">
+ <table class="wide" tal:omit-tag="noInfo">
+ <tr style="vertical-align: top" tal:omit-tag="noInfo">
+ <td style="padding-right: 1em; width: 200px" tal:condition="not:noInfo">
+ <tal:block tal:content="structure userinfo" />
+ <br />
+ <tal:block tal:content="structure navigation" />
+ </td>
+ <td tal:omit-tag="noInfo" tal:content="structure rendered"></td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <br />
+ <hr />
+ <a tal:attributes="href string:${layout/@@absolute_url}/../../"
+ i18n:translate="">
+ Back to principals management panel</a>
+ </td>
+ </tr>
+ </table>
+ </div>
+</div>
Added: z3ext.principals/trunk/src/z3ext/principals/layoutpage.pt
===================================================================
--- z3ext.principals/trunk/src/z3ext/principals/layoutpage.pt (rev 0)
+++ z3ext.principals/trunk/src/z3ext/principals/layoutpage.pt 2008-03-25 12:43:23 UTC (rev 84926)
@@ -0,0 +1,3 @@
+<div id="z-portal-workspace">
+ <div class="page" tal:content="structure view/render"></div>
+</div>
Added: z3ext.principals/trunk/src/z3ext/principals/management.pt
===================================================================
--- z3ext.principals/trunk/src/z3ext/principals/management.pt (rev 0)
+++ z3ext.principals/trunk/src/z3ext/principals/management.pt 2008-03-25 12:43:23 UTC (rev 84926)
@@ -0,0 +1,43 @@
+<tal:block i18n:domain="z3ext">
+ <h1 tal:content="context/__title__">User management.</h1>
+ <div class="pageDescription" tal:content="context/__description__"></div>
+
+ <div class="topframe" tal:on-error="nothing"
+ tal:define="factories view/factories"
+ tal:condition="factories">
+ <h1 i18n:translate="">Create principal</h1>
+
+ <ul class="listing">
+ <li tal:repeat="factory factories">
+ <div class="icon"
+ tal:define="icon factory/@@zmi_icon|nothing"
+ tal:content="structure icon">
+ </div>
+ <div class="details">
+ <a tal:attributes="href string:${factory/name}/"
+ tal:content="factory/title">Add new principal.</a>
+ <div><tal:block tal:content="factory/description" /> </div>
+ </div>
+ </li>
+ </ul>
+ </div>
+
+ <div class="frame">
+ <form action="@@index.html" method="post">
+ <h1 tal:content="view/label">View</h1>
+
+ <div class="fieldset">
+ <tal:block tal:define="widget nocall:view/principal_widget">
+ <metal:block use-macro="context/@@form_macros/widget_row" />
+ </tal:block>
+
+ <hr />
+ <div class="z-form-controls">
+ <input class="z-form-button" type="submit"
+ value="View principal" name="form.view"
+ i18n:attributes="value" />
+ </div>
+ </div>
+ </form>
+ </div>
+</tal:block>
Added: z3ext.principals/trunk/src/z3ext/principals/management.py
===================================================================
--- z3ext.principals/trunk/src/z3ext/principals/management.py (rev 0)
+++ z3ext.principals/trunk/src/z3ext/principals/management.py 2008-03-25 12:43:23 UTC (rev 84926)
@@ -0,0 +1,99 @@
+##############################################################################
+#
+# Copyright (c) 2007 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.
+#
+##############################################################################
+"""
+
+$Id$
+"""
+from zope import schema, interface, component
+from zope.component import getAdapters, getUtility, queryMultiAdapter
+
+from zope.app.form.utility import setUpWidget
+from zope.app.form.interfaces import IInputWidget
+
+from zope.publisher.interfaces import NotFound
+from zope.app.security.vocabulary import PrincipalSource
+from zope.app.security.interfaces import IAuthentication, PrincipalLookupError
+
+from z3ext.preferences.interfaces import IPreferenceGroup
+from z3ext.statusmessage.interfaces import IStatusMessage
+
+from z3ext.principals.i18n import _
+from z3ext.principals.interfaces import IPrincipalFactory
+from z3ext.principals.interfaces import IPrincipalPreferences
+from z3ext.principals.interfaces import IPrincipalsManagement
+
+
+class ManagementView(object):
+ interface.implements(IPrincipalsManagement)
+
+ label = _('Select principal')
+
+ def factories(self):
+ factories = []
+ for name, factory in getAdapters(
+ (self.context, self.request), IPrincipalFactory):
+ factories.append((factory.title, name, factory))
+
+ factories.sort()
+ return [factory for t,n,factory in factories]
+
+ def setupWidgets(self):
+ self.principal = schema.Choice(
+ title = _(u"Principal"),
+ description = _(u"Select principal to view/edit."),
+ source = PrincipalSource(),
+ required = False)
+
+ setUpWidget(self, 'principal', self.principal, IInputWidget)
+ self.widgets = {'principal': self.principal_widget}
+
+ def update(self):
+ request = self.request
+
+ self.setupWidgets()
+
+ if 'form.view' in request:
+ principal = self.principal_widget.getInputValue()
+ if not principal:
+ IStatusMessage(request).add(
+ _(u'Please select principal.'), 'warning')
+ else:
+ self.redirect('%s/@@index.html'%principal)
+
+
+class TraverserPlugin(object):
+ component.adapts(IPrincipalsManagement, interface.Interface)
+
+ def __init__(self, context, request):
+ self.context = context
+ self.request = request
+
+ def publishTraverse(self, request, name):
+ context = self.context
+
+ view = queryMultiAdapter((context, request), name=name)
+ if view is not None:
+ return view
+
+ try:
+ principal = getUtility(IAuthentication).getPrincipal(name)
+ except PrincipalLookupError:
+ raise NotFound(context, name, request)
+
+ root = getUtility(IPreferenceGroup)
+ root = root.__bind__(context, principal)
+ root.__name__ = name
+
+ interface.alsoProvides(root, IPrincipalPreferences)
+ return root
Property changes on: z3ext.principals/trunk/src/z3ext/principals/management.py
___________________________________________________________________
Name: svn:keywords
+ Id
Added: z3ext.principals/trunk/src/z3ext/principals/newprincipal.gif
===================================================================
(Binary files differ)
Property changes on: z3ext.principals/trunk/src/z3ext/principals/newprincipal.gif
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
Added: z3ext.principals/trunk/src/z3ext/principals/system-users.png
===================================================================
(Binary files differ)
Property changes on: z3ext.principals/trunk/src/z3ext/principals/system-users.png
___________________________________________________________________
Name: svn:mime-type
+ application/octet-stream
More information about the Checkins
mailing list