ZopeMag's mascot the ZOPE fish


Article Finder
People
Issue 1 - Revision 5  /   June 14, 2002 


 
  ZopeMag Links:
Home Page
About the Fish
Issue 09
Issue 08
Issue 07
Issue 06
Issue 05
Issue 04
Issue 03
Issue 02
Issue 01
Latest Issue

 
 
Downloads
     
  Letter from the Editor:
   Welcome

Interviews:
In our first issue we interview the father of the Wiki and the inventor of Extreme Programming.

 Ward Cunningham

Tutorials:
Throughout the quarter we cover topics of interest to Zope developers, designers, and users.

  MetaFlow
  Databases and ZPTs
  Custom User Folders
  Zope and CSS
  Intranets

Product Review:
Every two weeks we review a new Zope Product

  Z Shrink
  External File
  DocumentLibrary
  ZWiki


 
 
Downloads
     
  Downloads:
Products we talk about in this issues Articles and Reviews

  ZShrink
  Zope Page Templates
  LocalFS
  SimpleZPTmyAdmin
  Extended User Folder
  MetaFlow
 
     

Illustration by Brendan Davis
tutorial
CSS enables you to provide different views of your website so end users can choose which view they prefer.

Customized User Folders Part I
Write your own product that suits you best.
- - - - - - - - - - - -

By Kristoph Kirchner | May 22, 2002



Introduction

Security is an important part of most websites - especially if they provide some content that should be accessible only by registered users. Zope already provides standard security with the Zope user folder.

Download an example
Extended User Folder here.

However, sometimes you might want to store more information about the users or have the user folder react differently than what is possible with the Zope user folder. In that case you can either use one of the existing user folder products or write your own product that suits you best.

This article deals with how to use the existing python code of the Zope user folder to create your own user folder. There will be a simple example of how to create an extra property that for users.

The Basics

Zope's authentication mechanism is defined in the lib/python/AccessControl directory in your Zope installation. Here, you find modules such as Role.py, Permission.py and User.py. The module User.py contains several classes that make up the user folder and all it's function. The classes are as follows:

  • BasicUser
  • SimpleUser
  • SpecialUser
  • User
  • UnrestrictedUser
  • NullUnrestrictedUser
  • BasicUserFolder
  • UserFolder


The User Classes

The BasicUser class is the super-class for the other user classes. It defines the basics for the authentication and provides interfaces for methods concerning the user information. These methods need to be implemented by any class that sub-classes the BasicUser class.

The SimpleUser class defines all methods that are needed to add, edit and delete a simple user. This is the class that you should sub-class from if you want to make only small changes to the standard Zope user, such as adding a new field for user information.

The SpecialUser class is for users such as the emergency user and nobody. It overwrites the getId() method.

The User class is a sub-class of the SimpleUser class and is used for the standard Zope user. It doesn't have any methods but only exists because of sub-classing. The UnrestrictedUser class is for users that are to pass all security checks. It overwrites the methods allowed(), hasRole() (deprecated), has_role() and has_permission(). Users of this class can only be restricted by methods defined in the Owner.py module.

The NullUnrestrictedUser class is mostly for backward compatibility so that third party user folder implementations that expect an emergency user to exist in Zope will still work.

The User Folder Classes

The BasicUserFolder class contains the methods for authorization and authentication as well as the methods for managing a simple user.

The UserFolder class sub-classes the BasicUserFolder and adds persistent mapping to it.

.  1  2  3
Next page  |  Example: Adding an Email Property to Users



shim
shim  ZopeMag is committed to bringing you the best in Zope Documentation. shim
shim


Home   Subscribe   FAQ   Contact   Write for us   Privacy Policy   Weekly News   PyZine   opensourcexperts.com  

Reproduction of material from any of ZopeMag's pages without prior written permission is strictly prohibited. Copyright 2003 - 2005 ZopeMag Zope/Plone hosting by Nidelven IT