Anders Karlsson wrote:

> I'm trying to help Michael Ed  <[EMAIL PROTECTED]> to setup an
> midgrad-demo site that people who is interested in midgard could play
> with.
> To make this work, we need to restrict access to some settings, e.g.
> admin password & hosts.
> I thought  we could do that by using the MySQL privilege-system, so we
> tried to set all permissions for the midgard user on db-level to no,
> and then we garnted access on table-level.

I think the easiest way to accomplish this partial locking would be to
do
this:

modify midgard.c from midgard.lib (see attachment 1)

When refreshing the database:

$ awk '/CREATE TABLE/ { print $0; print "  rowlock smallint unsigned
DEFAULT '0' NOT NULL,"; next } { print $0 }' midgard.sql | mysql -uuser
-ppassword midgard
$ for table in article element file grp host image member page
pageelement person preference style topic; do
> echo update $table set rowlock=1; | mysql -uuser -ppassword midgard
> done

This locks all elements in the original database from being changed or
deleted, but will allow people
to add, change and delete new elements of any type.

Bye,
Emile

P.S. I'd greatly appreciate it if you could turn off HTML mail for this
list. My newsclient often shows
no content at all when it meets HTML mail.
--- midgard.c.bak       Mon Nov 22 16:31:35 1999
+++ midgard.c   Mon Nov 22 16:33:02 1999
@@ -503,7 +503,7 @@
 
     /* format command */
     command = mgd_format(mgd->tmp,
-                        "UPDATE $s SET $s WHERE id=$d",
+                        "UPDATE $s SET $s WHERE id=$d AND rowlock == 0",
                         table, fields, id);
     if (!command) return 0;
 
@@ -520,7 +520,7 @@
     int rv;
 
     /* format command */
-    command = mgd_format(mgd->tmp, "DELETE FROM $s WHERE id=$d", table, id);
+    command = mgd_format(mgd->tmp, "DELETE FROM $s WHERE id=$d AND rowlock == 0", 
+table, id);
     if (!command) return 0;
 
     /* execute command */

--
This is The Midgard Project's mailing list. For more information,
please visit the project's web site at http://www.midgard-project.org

To unsubscribe the list, send an empty email message to address
[EMAIL PROTECTED]

Reply via email to