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

Log in
Name

Password

 
 


Dublin Core Elements

The Dublin Core metadata element set is a standard for cross-domain information resource description.
Element Description Value
Identifier resource ID http://old.zope.org/Members/Ioan/UserManager
Title resource name User Manager
Description resource summary This product include <b>Admin</b> and <b>PhoneBook</b> and is for people who keep users into an SQL database. <br><br> Security is provided by <a href="http://www.zope.org/Members/otto/userdb">UserDB</a>.<br> This product don't include a UserDB instance.<br> You must add your own UserDB instance where you need to restrict access!<br> <br><br> Download the .zexp file and import it anywhere in your Zope tree except into Control_panel/products. <br><br> To work with this <b>UserManager</b> 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! <br><br> Then install <a href="http://www.zope.org/Members/otto/userdb">UserDB</a>.(The SQL tables are fit for UserDB.)<br> 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'.<br> <br> When you add a user from <b>PhoneBook</b> or from <b>UserManager</b> the user will have Zope role='Users' and group='whatever you selected to have'<br> <br><br> Into <b>dtml</b> you can check if current user can access current page with:<br> &lt;dtml-if "is_member('Writers')"&gt;<br> .. instructions ..<br> &lt;/dtml-if&gt;<br> 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.<br> <br> <br> <b>is_member</b> is a PythonScript:<br> <b>Title</b>: check if current user is member of groups<br> <b>Parameter List</b>: groups<br> <b>Body</b>:<pre> #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) </pre> In the same folder where is <b>is_member</b> you have to create and SQL Method:<br> <b>id</b>:SQL<br> <b>Arguments</b>:q</b><br> <b>body</b><br> &lt;dtml-var q&gt;<br> <br> <br><br> <h3>Create tables</h3> <pre><h4>users</h4>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) ); <h4>groups</h4>create table groups ( name varchar(20), description varchar(100) ); <h4>location</h4>create table location ( id integer, name varchar(30) ); <h4>department</h4>create table department ( id integer, name varchar(30) ); </pre>
Creator resource creator Ioan
Date default date 2001-11-09 00:27:46
Format resource format text/html
Type resource type Software Package
Subject resource keywords Developer, Examples, Helpers, User Management, Visual
Contributors resource collaborators
Language resource language
Publisher resource publisher No publisher
Rights resource copyright


Additional Zope Elements

Element Description Value
CreationDate date resource created 2001-11-09 00:27:46
ModificationDate date resource last modified 2001-11-09 00:27:46
EffectiveDate date resource becomes effective None
ExpirationDate date resource expires None

Backlinks: via Google / Technorati