Hi Stuart,
since you said that you have also been playing aroung with groups in Slide I
thought this might interest you.
I finally found a way to create user groups in Slide dynamically in
real-time. The only problem is that I couldn't do this without "cheating".
The solution is to modify the Slides database directly, this doesn't require
any restarting.. I simply added a group in the Domain.xml and checked which
tables the Slide altered and how and copied the information to the SQL
scripts below.
Here are the MySQL scripts I used to create a new group (this was done with
php for testing, so please ignore the static dates):
//CHILDREN
$query[] = "INSERT INTO children (uri,childuri) VALUES
('/users','$grpuri')";
//LATESTREVISIONS
$query[] = "INSERT INTO latestrevisions (uri,branchname,xnumber) VALUES
('$grpuri', '$branch', '$xnum')";
//OBJECTS
$query[] = "INSERT INTO objects (uri,classname) VALUES ('$grpuri',
'org.apache.slide.structure.GroupNode')";
//PROPERTY
$query[] = "INSERT INTO property
(uri,xnumber,name,value,namespace,type,protected) VALUES ('$grpuri',
'$xnum', 'source','','DAV:','','1')";
$query[] = "INSERT INTO property
(uri,xnumber,name,value,namespace,type,protected) VALUES ('$grpuri',
'$xnum', 'resourcetype','<collection/>','DAV:','','1')";
$query[] = "INSERT INTO property
(uri,xnumber,name,value,namespace,type,protected) VALUES ('$grpuri',
'$xnum', 'creationdate','2003-08-11T07:19:37Z','DAV:','','1')";
$query[] = "INSERT INTO property
(uri,xnumber,name,value,namespace,type,protected) VALUES ('$grpuri',
'$xnum', 'getcontentlength','0','DAV:','','1')";
$query[] = "INSERT INTO property
(uri,xnumber,name,value,namespace,type,protected) VALUES ('$grpuri',
'$xnum', 'displayname','".$_GET["groupname"]."','DAV:','','0')";
$query[] = "INSERT INTO property
(uri,xnumber,name,value,namespace,type,protected) VALUES ('$grpuri',
'$xnum', 'getlastmodified','Mon, 11 Aug 2003 07:19:37 GMT','DAV:','','1')";
//REVISION
$query[] = "INSERT INTO revision (uri,xnumber,branchname ) VALUES
('$grpuri','$xnum','$branch')";
//REVISIONS
$query[] = "INSERT INTO revisions (uri,isversioned,initialrevision ) VALUES
('$grpuri','0','1.0')";
-----
and these are the ones I used to add users to a group:
-----
//CHILDREN
$query[] = "INSERT INTO children (uri,childuri) VALUES
('$grpuri','$usrlink')";
//LATESTREVISIONS
$query[] = "INSERT INTO latestrevisions (uri,branchname,xnumber) VALUES
('$usrlink', '$branch', '$xnum')";
//LINKS
$query[] = "INSERT INTO links (link,linkto) VALUES ('$usrlink','$usruri')";
//OBJECTS
$query[] = "INSERT INTO objects (uri,classname) VALUES ('$usrlink',
'org.apache.slide.structure.LinkNode')";
//PROPERTY
$query[] = "INSERT INTO property
(uri,xnumber,name,value,namespace,type,protected) VALUES ('$usrlink',
'$xnum', 'source','','DAV:','','1')";
$query[] = "INSERT INTO property
(uri,xnumber,name,value,namespace,type,protected) VALUES ('$usrlink',
'$xnum', 'resourcetype','<collection/>','DAV:','','1')";
$query[] = "INSERT INTO property
(uri,xnumber,name,value,namespace,type,protected) VALUES ('$usrlink',
'$xnum', 'creationdate','2003-08-11T07:19:37Z','DAV:','','1')";
$query[] = "INSERT INTO property
(uri,xnumber,name,value,namespace,type,protected) VALUES ('$usrlink',
'$xnum', 'getcontentlength','0','DAV:','','1')";
$query[] = "INSERT INTO property
(uri,xnumber,name,value,namespace,type,protected) VALUES ('$usrlink',
'$xnum', 'displayname','".$_GET["groupname"]."','DAV:','','0')";
$query[] = "INSERT INTO property
(uri,xnumber,name,value,namespace,type,protected) VALUES ('$usrlink',
'$xnum', 'getlastmodified','Mon, 11 Aug 2003 07:19:37 GMT','DAV:','','1')";
//REVISION
$query[] = "INSERT INTO revision (uri,xnumber,branchname ) VALUES
('$usrlink','$xnum','$branch')";
//REVISIONS
$query[] = "INSERT INTO revisions (uri,isversioned,initialrevision ) VALUES
('$usrlink','0','1.0')";
I know that this isn't a clean way to do this, but since I didn't find any
better ideas this'll have to do. I tested the above scripts and they worked.
If somebody has an easier way of doing this (without touching Java ;-)),
ideas are welcome!
Cheers
Mikko H�m�l�inen
----- Original Message -----
From: "Stuart MacPherson" <[EMAIL PROTECTED]>
To: "'Slide Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Thursday, August 07, 2003 12:08 PM
Subject: RE: Creating groups with JDBC
Hi Mikko
Sorry I don't have a solution for you... I have been trying to do similar
things... Are you now able to create users in JDBCRealm using the
Slide-Admin web-app? At the moment I can only create a user if I actually
go into the database and insert data into 'user' and 'user-roles' manually.
If you have any tips that would be great, it seems to be quite quiet in
here!
Many thanks
Stuart
-----Original Message-----
From: Mikko H�m�l�inen [mailto:[EMAIL PROTECTED]
Sent: 07 August 2003 08:26
To: Slide Users Mailing List
Subject: Creating groups with JDBC
Hi
I use the Tomcat/Slide for managing user permissions and files on a
project-management site. The users can have different permissions on their
own home directory and different ones for every project goup they are
members of.
I managed to create a system where I can dynamically create user without the
need of restarting Tomcat every time a new user is created. I've done this
by configuring the Tomcat to use JDBC store as a user DB instead of the
tomcat-users.xml.
The next problem is that I must group users for setting ACL-permissions for
the whole group. I have no idea how to do this with JDBC store. With the
Domain.xml the procedure is simple with <objectnode
classname="org.apache.slide.structure.GroupNode" uri="/users/grpXXX"> (and
the example Domain.xml makes it even more simple), but I haven't been able
to find any information on how to do this with JDBC.. Should I add some
group-tables to the Tomcat's authentication DB or what.. Any
ideas/links/help appreciated.
I'd rather not use the Tomcat's roles for grouping users, since I have even
less idea what they are than I have on this JDBC store thing ;-)
Mikko H�m�l�inen
Espoon-Vantaan teknillinen ammattikorkeakoulu - EVTEK
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]