You are not logged in Log in Join
You are here: Home » Members » Ioan's Zope Documents » User Manager » swpackage_view

Log in
Name

Password

 
 

User Manager

This product include Admin and PhoneBook and is for people who keep users into an SQL database.

Security is provided by UserDB.
This product don't include a UserDB instance.
You must add your own UserDB instance where you need to restrict access!


Download the .zexp file and import it anywhere in your Zope tree except into Control_panel/products.

To work with this UserManager you must create 4 tables in any kind of SQL database you use (I tested with MS Access, MS SQL and Postgres) and fill them with information only by HTML links!

Then install UserDB.(The SQL tables are fit for UserDB.)
And add a UserDB instance into a folder, don't change anything into UserDB (you don't need) and force user authentification by creating a role Users and allow view right only for Users.

When you add a user from PhoneBook or from UserManager the user will have Zope role=Users and group='whatever you selected to have'


Into dtml you can check if current user can access current page with:
<dtml-if "is_member(Writers)">
.. instructions ..
</dtml-if>
Which means ALL users can view the page, but the page will be rendered only for users which are member of <b>Writers</b> group.


is_member is a PythonScript:
Title: check if current user is member of groups
Parameter List: groups
Body:

#check if current user is member of groups

import string user=context.REQUEST.AUTHENTICATED_USER.getUserName() gr=['Everyone'] for i in context.SQL(q="select * from users where username='"+user+"'"): gr=string.split('All,Everyone,+i.groups,,) break flag=0 for i in string.split(groups+,aa',,): if i in gr: flag=1 break return int(flag)

In the same folder where is is_member you have to create and SQL Method:
id:SQL
Arguments:q
body
<dtml-var q>



Create tables

users

create table users ( username varchar(20), name varchar(40), password varchar(20), domains varchar(20), roles varchar(20), groups varchar(2048), email varchar(20), ext varchar(20), mobile varchar(20), department integer, location integer, gendre varchar(2), description varchar(512) );

groups

create table groups ( name varchar(20), description varchar(100) );

location

create table location ( id integer, name varchar(30) );

department

create table department ( id integer, name varchar(30) );

Latest Release: 1.0
Last Updated: 2001-09-24 08:37:11
Author: Ioan
Categories: Developer, Examples, Helpers, User Management, Visual
Maturity: Stable

Available Releases

Version Maturity Platform Released
1.0 Stable   2001-09-24 08:37:11
  DemoUserManager.zexp (60 K) All