README: SPOPS/eg
========================================

This directory contains sample SPOPS code and classes you can use for
users, groups and security, along with sample scripts to test them
out. Plus two classes that are useful anywhere.


For the classes that are useful anywhere:

 My/DiscoverField.pm

     - class that implements an SPOPS::ClassFactory rule so that you
     do not need to specify fields in your object configuration if
     you're using all fields in the table. (Extremely handy!)

 My/DBI/FieldDefaults.pm

     - class that retrieves the information for a particular record to
     use as defaults.

 My/ReadOnly.pm

     - put this in your 'rules_from' key in the configuration and
     suddenly 'save()' and 'remove()' don't work anymore. Cool!

 My/UTFConvert.pm

     - for datasources that store data in unicode format, do automatic
     translation whenever the data are fetched and saved. WARNING:
     THIS CURRENTLY ONLY WORKS FOR 5.6.0 AND EARLIER, AND IS ONLY A
     DEMONSTRATION.

The remainder of the files are to demonstrate user, group and security
objects. You can use these as you like.

Note that if you create a database, run the data stocking script and
then clear the data out, the security data won't match up properly. In
particular, the ID of the group 'managers' (3) is hardcoded into both
My/Group.pm and My/User.pm. You might need to change it.

How to use these:

 (1) Either pick a database to use or create a new one

 (2) Create the schema -- this is dependent on your database. An
 example is:

 $ mysql --user=test --password=dingdong test < users_groups_mysql.sql

 (3) Set the parameters in My/Common.pm for your database and driver.

 (4) Run the user and group stocking script:

 $ perl stock_user_group.pl

 (5) Check out the raw data to see what it looks like:

 $ mysql --user=test --password=dingdong test
 mysql> select * from spops_user;
 ...
 mysql> select * from spops_security;

 (6) Run the doodad stocking script:

 $ perl stock_doodads.pl

 (7) Run the simple fetching script:

 $ perl fetch_doodads.pl

 (8) Export the data to an SPOPS-importable format:

 $ perl export_doodads.pl

 (9) Import some data from an SPOPS-portable format:

 $ perl import_doodads.pl

 (10) Dump it back out to see what happened:

 $ perl export_doodads.pl

 (10) Clear out the tables and do it all again, playing around with the
 different scripts and classes.

 $ mysql--user=test --password=dingdong test < users_groups_clear.sql



Schema files:

 users_groups_(mysql|pgsql|tsql).sql

     - SQL to create the user, group and linking tables. Three
     separate files for MySQL (mysql), PostgreSQL (pgsql) and
     Transact-SQL-based databases like Sybase ASE, Sybase ASA or
     Microsoft SQL Server (tsql).

 users_groups_clear.sql

     - SQL to clear out the tables (all databases)

 users_groups_clear_pgsql.sql

     - Extra SQL to clear out sequences from PostgreSQL. Run in
     addition to 'users_groups_clear.sql'.


Scripts to manipulate the objects:

 stock_user_group.pl

     - add some sample user/group data

 stock_doodads.pl

     - add sample objects

 fetch_doodads.pl

     - fetch sample objects as two different users, displaying
     different security settings for each

 export_doodads.pl

     - export the doodads in the database to STDOUT

 import_doodads.pl

     - import some more doodads


Object classes:

 My/Common.pm

     - common parents for the My::* hierarchy. You'll need to set a
     few values here so the objects know what database they are
     connecting to and how they'll connect.

 My/Doodad.pm

     - sample dummy object

 My/Group.pm

     - sample group object

 My/Security.pm

     - sample security object

 My/User.pm

     - sample user object

========================================
$Id: README,v 1.12 2001/12/19 06:44:53 lachoy Exp $