[Zope-Checkins] CVS: Zope3/lib/python/Zope/App/OFS/Services/AuthenticationService/Views/Browser - AddUser.py:1.1 EditUser.py:1.1 __init__.py:1.1 addUser.pt:1.1 configure.zcml:1.1 editUser.pt:1.1

Stephan Richter srichter@cbu.edu
Sat, 13 Jul 2002 12:52:59 -0400


Update of /cvs-repository/Zope3/lib/python/Zope/App/OFS/Services/AuthenticationService/Views/Browser
In directory cvs.zope.org:/tmp/cvs-serv9375/AuthenticationService/Views/Browser

Added Files:
	AddUser.py EditUser.py __init__.py addUser.pt configure.zcml 
	editUser.pt 
Log Message:
Okay, this is a truely cheesy Authentication Service. You are not able to
specify multiple or different data sources, there are no groups and I
cannot specify roles on the user yet, since Issue 19 has not been
implemented.


=== Added File Zope3/lib/python/Zope/App/OFS/Services/AuthenticationService/Views/Browser/AddUser.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (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.
# 
##############################################################################
"""Connection Management GUI

$Id: AddUser.py,v 1.1 2002/07/13 16:52:58 srichter Exp $
"""
from Zope.Publisher.Browser.BrowserView import BrowserView
from Zope.App.OFS.Services.AuthenticationService.User import User

class AddUser(BrowserView):
    
    def action(self, id, title, description, login, password, roles):
        user = User(id, title, description, login, password)
        self.context.setObject(id, user)
        return self.request.response.redirect(self.request.URL[-2])


=== Added File Zope3/lib/python/Zope/App/OFS/Services/AuthenticationService/Views/Browser/EditUser.py ===
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (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.
# 
##############################################################################
"""Connection Management GUI

$Id: EditUser.py,v 1.1 2002/07/13 16:52:58 srichter Exp $
"""
from Zope.Publisher.Browser.BrowserView import BrowserView

class EditUser(BrowserView):
    
    def action(self, title, description, login, password, roles):
        user = self.context
        user.setTitle(title)
        user.setDescription(description)
        user.setLogin(login)
        if password != "DEFAULT":
            user.setPassword(password)
        return self.request.response.redirect(self.request.URL[-1])


=== Added File Zope3/lib/python/Zope/App/OFS/Services/AuthenticationService/Views/Browser/__init__.py ===
##############################################################################
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# 
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (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.
# 
##############################################################################



=== Added File Zope3/lib/python/Zope/App/OFS/Services/AuthenticationService/Views/Browser/addUser.pt ===
<html metal:use-macro="views/standard_macros/page">
<head>
  <title>Add User</title>
</head>
<body>

  <div metal:fill-slot="body">

    <form action="." method="post" enctype="multipart/form-data">
    
      <table>      
    	<tbody>   
    	
    	  <tr>
    	    <th>Id:</th>
    	    <td>
	      <input type="text" name="id" size="40" value="">  
            </td>
    	  </tr>
    	  <tr>
    	    <th>Title:</th>
    	    <td>
	      <input type="text" name="title" size="40" value="">  
            </td>
    	  </tr>
    	  <tr>
    	    <th>Description:</th>
    	    <td>
	      <input type="text" name="description" size="40" value="">  
            </td>
    	  </tr>
    	  <tr>
    	    <th>Login:</th>
    	    <td>
	      <input type="text" name="login" size="40" value="">  
            </td>
    	  </tr>
    	  <tr>
    	    <th>Password:</th>
    	    <td>
	      <input type="password" name="password" size="40" value="">  
            </td>
    	  </tr>
    	  <tr>
    	    <th>Roles:</th>
    	    <td>
	      <select name="roles:list">
	        <option value="Manager">Manager</option>
              </select>
            </td>
    	  </tr>
    	    	
    	</tbody>     
      </table>
    
      <input type="submit" name="action.html:method" value="Add" />
    
    </form> 

  </div>

</body>
</html>

=== Added File Zope3/lib/python/Zope/App/OFS/Services/AuthenticationService/Views/Browser/configure.zcml ===
<zopeConfigure
   xmlns="http://namespaces.zope.org/zope"
   xmlns:browser="http://namespaces.zope.org/browser"
   package="Zope.App.OFS.Services.AuthenticationService">

<!-- Handle all Authentication Service configuration -->

  <browser:menu id="add_user" 
      title="Menu for adding new User." />

  <browser:defaultView 
     for=".AuthenticationService.ILocalAuthenticationService"
     name="index.html" />

  <browser:view 
     permission="Zope.ManageServices" 
     for=".AuthenticationService.ILocalAuthenticationService"
     factory="Zope.App.OFS.Container.Views.Browser.Contents.">

     <browser:page name="index.html" attribute="index" />

  </browser:view>

  <browser:view
      name="+"  
      for=".AuthenticationService.ILocalAuthenticationService"
      permission="Zope.ManageContent"
      factory=".Views.Browser.AddUser." >

    <browser:page name="index.html"  template="Views/Browser/addUser.pt" />
    <browser:page name="action.html" attribute="action" />

  </browser:view>

  <browser:menuItem menu="add_component" for="Zope.App.OFS.Container.IAdding."
       action="AuthenticationService"  title="Simple Authentication Service"
       description="A Persistent Authentication Service"
       />


  <!-- Handle User configuration -->

  <browser:defaultView for="Zope.App.Security.IPrincipal." 
      name="editForm.html" />

  <browser:view
      for="Zope.App.Security.IPrincipal."
      permission="Zope.View"
      factory=".Views.Browser.EditUser.">

    <browser:page name="editForm.html" 
        template="Views/Browser/editUser.pt" />
    <browser:page name="edit.html" attribute="action" />

  </browser:view>

  <browser:menuItems menu="zmi_views" for="Zope.App.Security.IPrincipal.">
    <browser:menuItem title="Edit" action="editForm.html"/>
  </browser:menuItems>

</zopeConfigure>


=== Added File Zope3/lib/python/Zope/App/OFS/Services/AuthenticationService/Views/Browser/editUser.pt ===
<html metal:use-macro="views/standard_macros/page">
<head>
  <title>Edit User</title>
</head>
<body>

  <div metal:fill-slot="body">

    <h1>User id: <span tal:replace="context/getId">12</span></h1>

    <form action="." method="post" enctype="multipart/form-data">
    
      <table>      
    	<tbody>   
    	
    	  <tr>
    	    <th>Title:</th>
    	    <td>
	      <input type="text" name="title" size="40" value="" 
                  tal:attributes="value context/getTitle">  
            </td>
    	  </tr>
    	  <tr>
    	    <th>Description:</th>
    	    <td>
	      <input type="text" name="description" size="40" value=""  
                  tal:attributes="value context/getDescription">  
            </td>
    	  </tr>
    	  <tr>
    	    <th>Login:</th>
    	    <td>
	      <input type="text" name="login" size="40" value=""
                  tal:attributes="value context/getLogin">  
            </td>
    	  </tr>
    	  <tr>
    	    <th>Password:</th>
    	    <td>
	      <input type="password" name="password" size="40" value="DEFAULT">
            </td>
    	  </tr>
    	  <tr>
    	    <th>Roles:</th>
    	    <td>
	      <select name="roles:list">
	        <option value="Manager">Manager</option>
              </select>
            </td>
    	  </tr>
    	    	
    	</tbody>     
      </table>
    
      <input type="submit" name="action.html:method" value="Edit" />
    
    </form> 

  </div>

</body>
</html>