venice-dynamo-rewrite/conf/venice-db-init-mysql.sql
Eric J. Bowersox 9218e24591 added database tables outlining "community" objects and initial interface
definition for community and community service
2003-05-27 09:04:40 +00:00

1048 lines
46 KiB
SQL

# The contents of this file are subject to the Mozilla Public License Version 1.1
# (the "License"); you may not use this file except in compliance with the License.
# You may obtain a copy of the License at <http://www.mozilla.org/MPL/>.
#
# Software distributed under the License is distributed on an "AS IS" basis, WITHOUT
# WARRANTY OF ANY KIND, either express or implied. See the License for the specific
# language governing rights and limitations under the License.
#
# The Original Code is the Venice Web Communities System.
#
# The Initial Developer of the Original Code is Eric J. Bowersox <erbo@silcom.com>,
# for Silverwrist Design Studios. Portions created by Eric J. Bowersox are
# Copyright (C) 2003 Eric J. Bowersox/Silverwrist Design Studios. All Rights Reserved.
#
# Contributor(s):
#
##############################################################################
# Database Creation
##############################################################################
DROP DATABASE IF EXISTS venice;
CREATE DATABASE venice;
USE venice;
##############################################################################
# Table Creation
##############################################################################
# The "namespace cache" table, used to map string namespaces (used in the code) to integer IDs
# (used in the database).
CREATE TABLE namespaces (
nsid INT NOT NULL PRIMARY KEY AUTO_INCREMENT, # namespace ID
namespace VARCHAR(255) BINARY NOT NULL, # the actual namespace
UNIQUE INDEX on_namespace (namespace)
);
# The global properties table.
CREATE TABLE globalprop (
nsid INT NOT NULL, # namespace ID of property
prop_name VARCHAR(255) BINARY NOT NULL, # name of the property
prop_value VARCHAR(255), # property value
PRIMARY KEY (nsid, prop_name)
);
# The global "blocks" table, used to store fragments of text/HTML for later use.
CREATE TABLE globalblock (
nsid INT NOT NULL, # namespace ID of block
block_name VARCHAR(255) BINARY NOT NULL, # name of block
block TEXT, # actual block (64K text)
PRIMARY KEY (nsid, block_name)
);
# The main user information table.
CREATE TABLE users (
uid INT NOT NULL PRIMARY KEY AUTO_INCREMENT, # user ID
username VARCHAR(64) NOT NULL, # user name
email VARCHAR(255) NOT NULL, # E-mail address
is_anon TINYINT DEFAULT 0, # is this the "anonymous" user?
locked TINYINT DEFAULT 0, # is this user account locked?
nospam TINYINT DEFAULT 0, # if 1, do not include this user in any mass mailings
created DATETIME NOT NULL, # date user was created
last_accessed DATETIME, # date user last logged in
UNIQUE INDEX on_username (username)
);
# The user authentication data table. We identify authentication methods by namespace ID
# and name, and provide "source data" to allow multiple sources for the same type of
# authentication (such as browser cookies for multiple browsers).
CREATE TABLE userauth (
uid INT NOT NULL, # user ID
nsid INT NOT NULL, # namespace ID of authentication method
method VARCHAR(255) BINARY NOT NULL, # name of authentication method
source_data VARCHAR(255), # source data for authentication method
auth_data VARCHAR(255), # authentication data
PRIMARY KEY (uid, nsid, method)
);
# The user properties table.
CREATE TABLE userprop (
uid INT NOT NULL, # user ID
nsid INT NOT NULL, # namespace ID of property
prop_name VARCHAR(255) BINARY NOT NULL, # name of property
prop_value VARCHAR(255), # property value
PRIMARY KEY (uid, nsid, prop_name)
);
# The groups table.
CREATE TABLE groups (
gid INT NOT NULL PRIMARY KEY AUTO_INCREMENT, # group ID
groupname VARCHAR(64) NOT NULL, # name of group
gaclid INT NOT NULL DEFAULT -1, # ACL ID for the group
UNIQUE INDEX on_groupname (groupname)
);
# The group membership table.
CREATE TABLE groupmembers (
gid INT NOT NULL, # ID of group
uid INT NOT NULL, # ID of user that is a member
PRIMARY KEY (gid, uid),
UNIQUE INDEX reverse_index (uid, gid)
);
# The group properties table.
CREATE TABLE groupprop (
gid INT NOT NULL, # ID of group
nsid INT NOT NULL, # namespace ID for property
prop_name VARCHAR(255) BINARY NOT NULL, # name of property
prop_value VARCHAR(255), # property value
PRIMARY KEY (gid, nsid, prop_name)
);
# The main ACL table. Each ACL has a numeric ID, a name, an unordered collection of owners (which may
# be groups or users), and an ordered collection of entries (ACEs).
CREATE TABLE acl (
aclid INT NOT NULL PRIMARY KEY AUTO_INCREMENT, # ID of the ACL
aclname VARCHAR(255) NOT NULL, # name of the ACL
INDEX on_name (aclname)
);
# The table of owners for ACLs. Each ACL has one or more owners.
CREATE TABLE aclowner (
aclid INT NOT NULL, # ID of the ACL
ownerid INT NOT NULL, # ID of the owner
flags TINYINT NOT NULL, # Flags Bit 0: 0=user, 1=group
INDEX on_acl (aclid)
);
# The table mapping ACLs to ACEs. Each ACL has zero or more ACEs.
CREATE TABLE acldata (
aclid INT NOT NULL, # ID of the ACL
seq INT NOT NULL, # sequence of this ACE
aceid INT NOT NULL, # ID of the corresponding ACE
PRIMARY KEY (aclid, seq)
);
# The main ACE table. Each ACE has a numeric ID, a principal reference (which may be a user or
# group ID), a "negative" flag, and an unordered collection of permissions.
CREATE TABLE ace (
aceid INT NOT NULL PRIMARY KEY AUTO_INCREMENT, # ID of this ACE
pri INT, # Principal reference
flags TINYINT NOT NULL DEFAULT 0 # Flags Bit 0: 0=user, 1=group
# Flags Bit 4: 0=positive ACE, 1=negative ACE
);
# The table mapping permissions into ACEs. Permissions are identified by namespace and name.
CREATE TABLE acedata (
aceid INT NOT NULL, # ID of this ACE
perm_nsid INT NOT NULL, # namespace ID of permission
perm_name VARCHAR(255) BINARY NOT NULL, # name of permission
INDEX on_ace (aceid)
);
# Global security data table. This table has only one row.
CREATE TABLE globalsec (
admin_uid INT NOT NULL, # administrator UID
admin_gid INT NOT NULL, # GID of administrators group
global_aclid INT NOT NULL, # ACLID of global ACL
alluser_gid INT NOT NULL, # GID of "all users" GID
verified_gid INT NOT NULL # GID of "verified users" GID
);
# The audit information table. Each audit "event" can have up to 8 properties defined with it,
# which are serialized as other "properties."
CREATE TABLE audit (
record BIGINT NOT NULL PRIMARY KEY AUTO_INCREMENT, # audit record ID
on_date DATETIME NOT NULL, # date stamp of audit record
event INT NOT NULL, # event ID
uid INT NOT NULL, # user ID of responsible user
subid INT NOT NULL DEFAULT 0, # "sub ID" (often community ID)
ip VARCHAR(48), # IP address of source
prop0 VARCHAR(255), # event property
prop1 VARCHAR(255), # event property
prop2 VARCHAR(255), # event property
prop3 VARCHAR(255), # event property
prop4 VARCHAR(255), # event property
prop5 VARCHAR(255), # event property
prop6 VARCHAR(255), # event property
prop7 VARCHAR(255), # event property
INDEX by_date (on_date),
INDEX sub_view (subid, on_date)
);
# The table where events are assigned "event IDs" in the master audit record,
# to cut down on space usage in the audit table. Event IDs can be predefined
# at database create time, or defined dynamically, or both.
CREATE TABLE auditevent (
eventid INT NOT NULL PRIMARY KEY AUTO_INCREMENT, # event ID
event_nsid INT NOT NULL, # namespace ID of event
event_name VARCHAR(255) BINARY NOT NULL, # event name
descr TINYTEXT, # event description
UNIQUE INDEX by_event (event_nsid, event_name)
);
# The image store table. This is used to store relatively small images like
# user photos and logos.
CREATE TABLE imagestore (
imageid INT NOT NULL PRIMARY KEY AUTO_INCREMENT, # image ID
typecode INT NOT NULL, # image type code
ownerid INT NOT NULL, # who owns it?
ownerflag TINYINT NOT NULL DEFAULT 0, # owner: user or group?
mimetype VARCHAR(128), # MIME type of image
length INT, # length of image in bytes
data MEDIUMBLOB # image data (max 16 Mb)
);
# The image type table, used to differentiate between images stored in the table.
CREATE TABLE imagetype (
typecode INT NOT NULL PRIMARY KEY AUTO_INCREMENT, # image type code
nsid INT NOT NULL, # image type namespace ID
name VARCHAR(255) BINARY NOT NULL # image type name
);
#### following this line are Venice-specific tables ####
# The table which defines menus.
CREATE TABLE menus (
menuid INT NOT NULL PRIMARY KEY AUTO_INCREMENT, # menu ID
menu_nsid INT NOT NULL, # namespace ID of menu name
menu_name VARCHAR(255) BINARY NOT NULL, # name of menu
title VARCHAR(255) NOT NULL, # menu title
subtitle VARCHAR(255) NULL, # menu subtitle
UNIQUE INDEX by_name (menu_nsid, menu_name)
);
# Definitions of variables for menus.
CREATE TABLE menuvars (
menuid INT NOT NULL, # menu ID
var_name VARCHAR(255) NOT NULL, # name of variable
default_val VARCHAR(255) NULL, # default value of variable
PRIMARY KEY (menuid, var_name)
);
# Definitions of menu items.
CREATE TABLE menuitems (
menuid INT NOT NULL, # menu ID
sequence INT NOT NULL, # sequence of menu item
itemtype VARCHAR(32) NOT NULL, # menu item type
enable TINYINT NOT NULL DEFAULT 1, # enable this menu item?
indent INT NOT NULL DEFAULT 0, # indent level of menu item
text VARCHAR(255) NULL, # text of menu item
linktype VARCHAR(32) NULL, # link type to use with menu item
link VARCHAR(255) NULL, # link for menu item
target VARCHAR(255) NULL, # target frame for menu item
title VARCHAR(255) NULL, # menu item title
on_click VARCHAR(255) NULL, # menu item onClick= property
perm_nsid INT NULL, # you must have this permission (namespace ID)
perm_name VARCHAR(255) BINARY NULL, # you must have this permission (name)
ifdef_var VARCHAR(255) NULL, # show item if this variable is defined
ifndef_var VARCHAR(255) NULL, # show item if this variable is not defined
PRIMARY KEY (menuid, sequence)
);
# The table mapping category IDs to category names.
CREATE TABLE refcategory (
catid INT NOT NULL PRIMARY KEY, # category ID
parent INT NOT NULL, # parent category
symlink INT NOT NULL, # if this is a symlink, what category does it link to?
name VARCHAR(64) NOT NULL, # category name
dontuse TINYINT DEFAULT 0, # 1 if this is a deprecated category
UNIQUE INDEX display (parent, name)
);
# The master communities table.
CREATE TABLE communities (
cid INT NOT NULL PRIMARY KEY AUTO_INCREMENT, # community ID
member_gid INT NOT NULL, # group ID representing community members
host_gid INT NOT NULL, # group ID representing community hosts
host_uid INT NOT NULL, # UID of host
aclid INT NOT NULL, # community ACL ID
catid INT NOT NULL DEFAULT 0, # community category ID (xref to "refcategory" table)
hide_dir TINYINT NOT NULL DEFAULT 0, # do we want to hide community from directory?
hide_search TINYINT NOT NULL DEFAULT 0, # do we want to hide community from searches?
name VARCHAR(128) NOT NULL, # community name
alias VARCHAR(32) NOT NULL, # community alias
createdate DATETIME NOT NULL, # creation date/time
lastaccess DATETIME, # last access date/time
lastupdate DATETIME, # last update date/time
INDEX by_name (name),
UNIQUE INDEX by_alias (alias),
INDEX by_catdate (catid, createdate),
INDEX by_create (createdate),
INDEX by_catname (catid, name)
);
# Community access table, which dictates if a community is public or private and the way people
# have to authenticate to join it.
CREATE TABLE commaccess (
cid INT NOT NULL, # the community ID
ugid INT NOT NULL, # user or group ID
is_group TINYINT NOT NULL, # 1 if this is a group, 0 if a user
single_use TINYINT NOT NULL DEFAULT 0, # if 1, this will be removed after a join
auth_nsid INT NULL, # authenticator namespace ID (NULL for none)
auth_name VARCHAR(255) BINARY NULL, # authenticator name (NULL for none)
source_data VARCHAR(255), # authenticator source data
auth_data VARCHAR(255), # authentication data
PRIMARY KEY (cid, is_group, ugid)
);
# The community properties table.
CREATE TABLE commprops (
cid INT NOT NULL, # community ID
nsid INT NOT NULL, # namespace ID of property
prop_name VARCHAR(255) BINARY NOT NULL, # name of property
prop_value VARCHAR(255), # property value
PRIMARY KEY (cid, nsid, prop_name)
);
##############################################################################
# Set table access rights
##############################################################################
# this is a test only - remove when we go to production
GRANT ALL PRIVILEGES ON venice.*
TO erbo@localhost IDENTIFIED BY 'meesatest'
WITH GRANT OPTION;
GRANT INSERT, DELETE, UPDATE, SELECT, LOCK TABLES ON venice.*
TO veniceuser@localhost IDENTIFIED BY 'XYZZY0099';
##############################################################################
# Initialization data
##############################################################################
# Initial namespaces setup
INSERT INTO namespaces (nsid, namespace) VALUES
(1, 'http://www.silverwrist.com/NS/venice/2002/12/21/frame.look.and.feel' ),
(2, 'http://www.silverwrist.com/NS/venice/2002/12/22/stylesheets' ),
(3, 'http://www.silverwrist.com/NS/dynamo/2002/12/13/user.information' ),
(4, 'http://www.silverwrist.com/NS/dynamo/2002/12/27/group.permissions' ),
(5, 'http://www.silverwrist.com/NS/venice/2002/12/28/mail.properties' ),
(6, 'http://www.silverwrist.com/NS/venice/2002/12/28/content.look.and.feel'),
(7, 'http://www.silverwrist.com/NS/venice/2002/12/30/session.control' ),
(8, 'http://www.silverwrist.com/NS/venice/2002/12/31/system.events' ),
(9, 'http://www.silverwrist.com/NS/venice/2002/12/31/user.events' ),
(10, 'http://www.silverwrist.com/NS/venice/2002/12/31/user.settings' ),
(11, 'http://www.silverwrist.com/NS/venice/2002/12/31/user.profile' ),
(12, 'http://www.silverwrist.com/NS/venice/2003/01/03/system.mail.messages' ),
(13, 'http://www.silverwrist.com/NS/venice/2003/05/24/system.permissions' );
# Initial global properties setup
INSERT INTO globalprop (nsid, prop_name, prop_value) VALUES
(1, 'site.title', '!Venice Test' ),
(1, 'optionset', '_OS:AC' ),
(1, 'site.url', '!http://localhost:8080/venice/' ),
(1, 'site.logo.url', '!temp/site-logo.jpg' ),
(1, 'site.logo.url.type', '!IMAGE' ),
(1, 'site.logo.width', 'I140' ),
(1, 'site.logo.height', 'I80' ),
(1, 'frame.template', '!frame.vm' ),
(1, 'footer.logo.scale', 'I100' ),
(1, 'page.icon.url', '!venice-icon.png' ),
(1, 'page.icon.url.type', '!IMAGE' ),
(1, 'page.icon.type', '!image/png' ),
(1, 'page.favicon.url', '!venice-favicon.ico' ),
(1, 'page.favicon.url.type', '!IMAGE' ),
(1, 'frontpage.title', '!My Front Page' ),
(1, 'left.bar.width', 'I120' ),
(2, 'sheet.base.normal', '!stylesheets/normal_base.vm' ),
(2, 'sheet.adv.normal', '!stylesheets/adv_base.vm' ),
(5, 'smtp.host', '!localhost' ),
(5, 'system.mail.from.addr', '!nobody@delenn.silverwrist.internal'),
(5, 'system.mail.from.name', '!Venice Mail System' ),
(5, 'mailer.name', '!Venice AutoMail System' ),
(5, 'user.info.header', '!X-Venice-User-Info' ),
(6, 'subdir.buttons', '!buttons/classic' ),
(6, 'std.button.width', 'I80' ),
(6, 'std.button.height', 'I24' ),
(6, 'bn.0transparent', '!transparent.gif' ),
(6, 'bnc.0transparent', '!' ),
(6, 'bn.cancel', '!cancel.jpg' ),
(6, 'bnc.cancel', '!Cancel' ),
(6, 'bn.configure', '!configure.jpg' ),
(6, 'bnc.configure', '!Configure' ),
(6, 'bn.create', '!create.jpg' ),
(6, 'bnc.create', '!Create' ),
(6, 'bn.i.accept', '!user_accept.jpg' ),
(6, 'bnc.i.accept', '!I Accept' ),
(6, 'bn.i.decline', '!user_decline.jpg' ),
(6, 'bnc.i.decline', '!I Decline' ),
(6, 'bn.login', '!login.jpg' ),
(6, 'bnc.login', '!Log In' ),
(6, 'bn.next', '!arrow_next.jpg' ),
(6, 'bnc.next', '!Next' ),
(6, 'bn.ok', '!ok.jpg' ),
(6, 'bnc.ok', '!OK' ),
(6, 'bn.previous', '!arrow_previous.jpg' ),
(6, 'bnc.previous', '!Previous' ),
(6, 'bn.reminder', '!reminder.jpg' ),
(6, 'bnc.reminder', '!Reminder' ),
(6, 'bn.search', '!search.jpg' ),
(6, 'bnc.search', '!Search' ),
(6, 'bn.send.again', '!send_again.jpg' ),
(6, 'bnc.send.again', '!Send Again' ),
(6, 'bn.send.email', '!send_email.jpg' ),
(6, 'bnc.send.email', '!Send E-Mail' ),
(6, 'bn.set', '!set.jpg' ),
(6, 'bnc.set', '!Set' ),
(6, 'bn.update', '!update.jpg' ),
(6, 'bnc.update', '!Update' ),
(6, 'user.agreement.title', '!Venice User Agreement' ),
(6, 'user.photo.width', 'I100' ),
(6, 'user.photo.height', 'I100' ),
(6, 'user.nophoto.url', '!photo_not_avail.gif' ),
(6, 'user.nophoto.url.type', '!IMAGE' ),
(7, 'session.init.script', '!/util/session_init.js' ),
(7, 'login.cookie', '!VeniceAuth' ),
(7, 'login.cookie.maxage', 'I365' ),
(7, 'password.recovery.time', 'I60' ),
(10, 'timezone', '_TZ:UTC' ),
(10, 'locale', '_LOC:en_US' ),
(10, 'admin.flags', '_OS:' ),
(10, 'search.result.count', 'I20' ),
(11, 'privacy', '_OS:' ),
(12, 'confirm.message.title', '!Venice E-Mail Confirmation' ),
(12, 'password.change.message.title', '!Venice Password Changed' ),
(12, 'reminder.message.title', '!Venice Password Reminder Message' );
# Initial global blocks setup
INSERT INTO globalblock (nsid, block_name, block) VALUES
(1, 'footer',
'All trademarks and copyrights on this page are owned by their respective companies.
All messages posted by users on this page are owned by those users.
The rest: Copyright &copy; 2002-2003 Silverwrist Design Studios, All Rights Reserved.
See our <a href="TODO">Policy Page</a> for our copyright and privacy policies.'),
(5, 'user.disclaimer',
'Message sent via Venice Web Communities System - <http://venice.sourceforge.net>
The Venice Project is not responsible for the contents of this message
Report abuses to: <abuse@example.com>'),
(5, 'signature',
'Venice - community services, conferencing and more. <http://venice.sourceforge.net>'),
(6, 'content.header',
'<span class="chdrtitle">$title</span>
#if( $subtitle )
&nbsp;&nbsp;<span class="chdrsubtitle">$subtitle</span>
#end
<hr align="left" size="2" width="90%" noshade="noshade" />'),
(6, 'std.bullet',
'<img src="#formatURL( "IMAGE" "purple-ball.gif" )" alt="*" width="14" height="14" border="0" />'),
(6, 'error.box',
'<p><table align="center" width="70%" border="1" cellpadding="2" cellspacing="1">
<tr valign="middle"><td class="errorhead">
#encodeHTML( $title )
</td></tr>
<tr valign="middle"><td class="errorbody">
<p>#encodeHTML( $message )</p>
<p>
#if( $back )
<a href="#formatURL( $backtype $back )">Go back.</a>
#else
Use your browser''s <b>Back</b> button to go back.
#end
</p>
</td></tr>
</table></p>
#if( $except )
<!--
#stacktrace( $except )
-->
#end'),
(6, 'user.agreement',
'Text of this agreement is to be determined.'),
(12, 'confirm.message',
'Welcome to the Venice Web Communities System! In order to fully activate your
account after you register or change your E-mail address, you must provide a
confirmation number to the system. Please enter this number into the "Confirm
E-mail Address" dialog on the system when indicated.
Your confirmation number for your account "$username" is $confnum.
Access the E-mail verification dialog at <http://localhost/venice/verifyemail>.
Thank you, and enjoy the Venice Web Communities System!
-- The Management'),
(12, 'password.change.message',
'The password for your account "$username" has been changed. The new
password is "$password".
You should log into Venice immediately and change the password to something
else. You can change the password for your account, once you are logged in,
by clicking on the "Profile" link in the top bar.
If you did NOT request a password change on your account, please notify the
system administrator IMMEDIATELY.
-- The Management'),
(12, 'reminder.message',
'Here is the password reminder for your account "$username" as you requested:
$reminder
If this reminder is not sufficient for you to remember what your password is,
then the system can change your password for you. To do so, please visit
the following URL:
http://localhost/venice/passrecovery/$uid/$auth
Your password will be changed and a new password will be E-mailed to you
at this address.
If you did NOT request a password reminder, then this message was sent
by someone attempting to access your account without your knowledge. Do
not panic! Nothing has happened to your account or password yet, but
please do notify the system administrator.
-- The Management');
# Initial users setup
# (UID 1 and 2)
INSERT INTO users (uid, username, email, is_anon, nospam, created) VALUES
(1, 'Anonymous_Honyak', 'nobody@localhost', 1, 1, '2002-12-15 12:00:00'),
(2, 'Administrator', 'root@localhost', 0, 0, '2002-12-26 18:00:00');
# Set up properties for Anonymous_Honyak.
INSERT INTO userprop (uid, nsid, prop_name, prop_value) VALUES
(1, 10, 'timezone', '_TZ:UTC' ),
(1, 10, 'locale', '_LOC:en_US'),
(1, 10, 'admin.flags', '_OS:A' ),
(1, 10, 'search.result.count', 'I20' ),
(1, 11, 'privacy', '_OS:' ),
(1, 11, 'name.given', '!Anonymous'),
(1, 11, 'name.family', '!Honyak' ),
(1, 11, 'locality', '!Nowhere' ),
(1, 11, 'region', '!XX' ),
(1, 11, 'postal.code', '!00000' ),
(1, 11, 'country', '_CTRY:US' );
# Add authentication for Administrator (no password by default)
INSERT INTO userauth (uid, nsid, method, source_data, auth_data) VALUES
(2, 3, 'default.hash.password', '', '');
# Set up properties for Administrator.
INSERT INTO userprop (uid, nsid, prop_name, prop_value) VALUES
(2, 10, 'timezone', '_TZ:UTC' ),
(2, 10, 'locale', '_LOC:en_US' ),
(2, 10, 'admin.flags', '_OS:' ),
(2, 10, 'search.result.count', 'I20' ),
(2, 11, 'privacy', '_OS:' ),
(2, 11, 'name.given', '!System' ),
(2, 11, 'name.family', '!Administrator'),
(2, 11, 'locality', '!Nowhere' ),
(2, 11, 'region', '!XX' ),
(2, 11, 'postal.code', '!00000' ),
(2, 11, 'country', '_CTRY:US' );
# Create a group for site administrators.
# (GID 1)
INSERT INTO groups (gid, groupname) VALUES (1, 'Site_Administration');
INSERT INTO groupmembers (gid, uid) VALUES (1, 2);
# Create an ACL for the site administrator group. The ACL is owned by Administrator
# and grants "add" and "remove" permissions to Administrator only.
# (ACL 1, ACE 1)
INSERT INTO acl (aclid, aclname) VALUES (1, 'Site_Administration');
INSERT INTO aclowner (aclid, ownerid, flags) VALUES (1, 2, 0);
INSERT INTO ace (aceid, pri, flags) VALUES (1, 2, 0);
INSERT INTO acldata (aclid, seq, aceid) VALUES (1, 0, 1);
INSERT INTO acedata (aceid, perm_nsid, perm_name) VALUES
(1, 4, 'add.member' ),
(1, 4, 'remove.member');
UPDATE groups SET gaclid = 1 WHERE gid = 1;
# Create the "all users" group.
# (GID 2)
INSERT INTO groups (gid, groupname) VALUES (2, 'All_Users');
INSERT INTO groupmembers (gid, uid) VALUES (2, 2);
# Create the "all verified users" group.
# (GID 3)
INSERT INTO groups (gid, groupname) VALUES (3, 'Verified_Users');
INSERT INTO groupmembers (gid, uid) VALUES (3, 2);
# Create the global ACL. This ACL is owned by the Administrator and grants
# permissions to the site administration group and to the Administrator specifically.
# (ACL 2, ACEs 2 and 3)
INSERT INTO acl (aclid, aclname) VALUES (2, 'Global_Permissions');
INSERT INTO aclowner (aclid, ownerid, flags) VALUES (2, 2, 0);
INSERT INTO ace (aceid, pri, flags) VALUES (2, 1, 1);
INSERT INTO acldata (aclid, seq, aceid) VALUES (2, 0, 2);
INSERT INTO acedata (aceid, perm_nsid, perm_name) VALUES
(2, 1, 'set.property' ),
(2, 1, 'set.block' ),
(2, 2, 'set.property' ),
(2, 3, 'edit.all' ),
(2, 3, 'bypass.email.verify'),
(2, 3, 'view.all' ),
(2, 5, 'set.property' ),
(2, 5, 'set.block' ),
(2, 6, 'set.property' ),
(2, 6, 'set.block' ),
(2, 7, 'set.property' ),
(2, 10, 'set.property' ),
(2, 10, 'remove.property' ),
(2, 11, 'set.property' ),
(2, 11, 'remove.property' ),
(2, 12, 'set.property' ),
(2, 12, 'set.block' ),
(2, 13, 'show.admin.menu' );
INSERT INTO ace (aceid, pri, flags) VALUES (3, 2, 0);
INSERT INTO acldata (aclid, seq, aceid) VALUES (2, 1, 3);
INSERT INTO acedata (aceid, perm_nsid, perm_name) VALUES
(3, 1, 'remove.property'),
(3, 1, 'remove.block' ),
(3, 2, 'remove.property'),
(3, 5, 'remove.property'),
(3, 5, 'remove.block' ),
(3, 6, 'remove.property'),
(3, 6, 'remove.block' ),
(3, 7, 'remove.property'),
(3, 12, 'remove.property'),
(3, 12, 'remove.block' );
# Create the entries in the global security table.
INSERT INTO globalsec (admin_uid, admin_gid, global_aclid, alluser_gid, verified_gid)
VALUES (2, 1, 2, 2, 3);
# Insert some audit event type records.
INSERT INTO auditevent (eventid, event_nsid, event_name, descr) VALUES
(1, 8, 'system.startup', 'Venice Server Startup' ),
(2, 8, 'system.shutdown', 'Venice Server Shutdown' ),
(3, 9, 'login.ok', 'Successful User Login' ),
(4, 9, 'login.fail', 'Failed User Login' ),
(5, 9, 'verify.ok', 'Successful E-Mail Address Verification'),
(6, 9, 'verify.fail', 'Failed E-Mail Address Verification' ),
(7, 9, 'resend.confirm.email', 'Re-Sent E-Mail Confirmation Message' ),
(8, 9, 'send.confirm.email', 'Sent E-Mail Confirmation Message' ),
(9, 9, 'user.created', 'New User Created' );
# Insert some image types.
INSERT INTO imagetype (typecode, nsid, name) VALUES
(1, 11, 'user.photo');
#### following this line is initialization of Venice-specific tables ####
# Populate the Category table.
# Source: Mozilla Open Directory Project categorization system <http://dmoz.org>;
# additional categorization from WebbMe categories
INSERT INTO refcategory (catid, parent, symlink, name) VALUES
(0, -1, -1, 'Unclassified'),
(1, -1, -1, 'Arts'),
(16, 1, -1, 'Animation'),
(17, 1, 181, 'Antiques'),
(18, 1, -1, 'Architecture'),
(19, 1, -1, 'Art History'),
(20, 1, -1, 'Body Art'),
(21, 1, -1, 'Celebrities'),
(22, 1, -1, 'Comics'),
(23, 1, -1, 'Crafts'),
(24, 1, -1, 'Dance'),
(25, 1, -1, 'Design'),
(26, 1, -1, 'Education'),
(27, 1, -1, 'Entertainment'),
(28, 1, -1, 'Graphic Design'),
(29, 1, -1, 'Humanities'),
(30, 1, -1, 'Illustration'),
(31, 1, -1, 'Literature'),
(32, 1, -1, 'Movies'),
(33, 1, -1, 'Music'),
(34, 1, -1, 'Myths and Folktales'),
(35, 1, -1, 'Native and Tribal'),
(36, 1, -1, 'Performing Arts'),
(37, 1, -1, 'Photography'),
(38, 1, -1, 'Radio'),
(39, 1, -1, 'Television'),
(40, 1, -1, 'Theatre'),
(41, 1, -1, 'Typography'),
(42, 1, -1, 'Video'),
(43, 1, -1, 'Visual Arts'),
(44, 1, -1, 'Writing'),
(2, -1, -1, 'Business'),
(45, 2, -1, 'Accounting'),
(46, 2, -1, 'Advertising'),
(47, 2, -1, 'Aerospace'),
(48, 2, -1, 'Agriculture and Forestry'),
(49, 2, -1, 'Apparel'),
(50, 2, -1, 'Arts and Entertainment'),
(51, 2, -1, 'Associations'),
(52, 2, -1, 'Aviation'),
(53, 2, -1, 'Business Services'),
(54, 2, 245, 'Classifieds'),
(55, 2, -1, 'Computers'),
(56, 2, -1, 'Consulting'),
(57, 2, -1, 'Construction and Maintenance'),
(58, 2, -1, 'Electronics'),
(59, 2, -1, 'Employment'),
(60, 2, -1, 'Energy and Utilities'),
(61, 2, -1, 'Environmental and Safety'),
(62, 2, -1, 'Financial Services'),
(63, 2, -1, 'Food and Related Products'),
(64, 2, -1, 'Insurance'),
(65, 2, -1, 'Internet Services'),
(66, 2, -1, 'Investing'),
(67, 2, 290, 'Law'),
(68, 2, -1, 'Management'),
(69, 2, -1, 'Manufacturing'),
(70, 2, -1, 'Marketing'),
(71, 2, -1, 'Mining and Drilling'),
(72, 2, -1, 'Printing'),
(73, 2, -1, 'Publishing'),
(74, 2, -1, 'Real Estate'),
(75, 2, -1, 'Retail'),
(76, 2, -1, 'Security'),
(77, 2, -1, 'Small Business'),
(78, 2, -1, 'Taxes'),
(79, 2, -1, 'Training and Schools'),
(80, 2, -1, 'Telecommunications'),
(81, 2, -1, 'Transportation'),
(82, 2, -1, 'Venture Capital'),
(3, -1, -1, 'Computers'),
(83, 3, -1, 'CAD'),
(84, 3, -1, 'Computer Science'),
(85, 3, -1, 'Consultants'),
(86, 3, -1, 'Data Communications'),
(87, 3, -1, 'Desktop Publishing'),
(88, 3, -1, 'Education'),
(89, 3, -1, 'Ethics'),
(90, 3, -1, 'Fonts'),
(91, 3, 124, 'Games'),
(92, 3, -1, 'Graphics'),
(93, 3, -1, 'Hacking'),
(94, 3, -1, 'Hardware'),
(95, 3, -1, 'History'),
(96, 3, -1, 'Internet'),
(97, 3, -1, 'Multimedia'),
(98, 3, -1, 'Open Source'),
(99, 3, -1, 'Operating Systems'),
(100, 3, -1, 'Programming'),
(101, 3, -1, 'Robotics'),
(102, 3, -1, 'Security'),
(103, 3, -1, 'Shopping'),
(104, 3, -1, 'Software'),
(105, 3, -1, 'Systems'),
(4, -1, -1, 'Games'),
(106, 4, -1, 'Board Games'),
(107, 4, -1, 'Card Games'),
(108, 4, -1, 'Coin-op Games'),
(109, 4, 123, 'Collectible Card Games'),
(110, 4, -1, 'Dice Games'),
(111, 4, 319, 'Fantasy Sports'),
(112, 4, -1, 'Gambling'),
(113, 4, -1, 'Game Creation Systems'),
(114, 4, -1, 'Game Design'),
(115, 4, -1, 'Hand Games'),
(116, 4, -1, 'Internet Games'),
(117, 4, -1, 'Party Games'),
(118, 4, -1, 'Puzzles'),
(119, 4, 270, 'Retailers'),
(120, 4, -1, 'Roleplaying Games'),
(121, 4, 14, 'Sports'),
(122, 4, -1, 'Tile Games'),
(123, 4, -1, 'Trading Cards'),
(124, 4, -1, 'Video Games'),
(125, 4, -1, 'Yard and Deck Games'),
(5, -1, -1, 'Health'),
(126, 5, -1, 'Aging'),
(127, 5, -1, 'Alternative Medicine'),
(128, 5, -1, 'Beauty'),
(129, 5, -1, 'Children''s Health'),
(130, 5, -1, 'Conditions and Diseases'),
(131, 5, -1, 'Dentistry'),
(132, 5, 280, 'Disabilities'),
(133, 5, -1, 'Education'),
(134, 5, -1, 'Fitness'),
(135, 5, 64, 'Health Insurance'),
(136, 5, -1, 'Medicine'),
(137, 5, -1, 'Men''s Health'),
(138, 5, -1, 'Mental Health'),
(139, 5, -1, 'Nursing'),
(140, 5, -1, 'Nutrition'),
(141, 5, -1, 'Occupational Health and Safety'),
(142, 5, -1, 'Pharmacy'),
(143, 5, -1, 'Public Health and Safety'),
(144, 5, -1, 'Reproductive Health'),
(145, 5, -1, 'Seniors'' Health'),
(146, 5, -1, 'Services'),
(147, 5, -1, 'Substance Abuse'),
(148, 5, -1, 'Teen Health'),
(149, 5, -1, 'Women''s Health'),
(6, -1, -1, 'Home'),
(150, 6, -1, 'Apartment Living'),
(151, 6, -1, 'Cooking'),
(152, 6, -1, 'Do-It-Yourself'),
(153, 6, -1, 'Emergency Preparation'),
(154, 6, -1, 'Entertaining'),
(155, 6, -1, 'Family'),
(156, 6, -1, 'Gardens'),
(157, 6, -1, 'Home Improvement'),
(158, 6, -1, 'Homemaking'),
(363, 6, -1, 'Homeowners'),
(159, 6, -1, 'Kids'),
(160, 6, -1, 'Moving and Relocating'),
(161, 6, -1, 'Nursery'),
(162, 6, 207, 'Pets'),
(163, 6, -1, 'Personal Finance'),
(164, 6, -1, 'Personal Organization'),
(165, 6, -1, 'Relatives'),
(166, 6, -1, 'Rural Living'),
(167, 6, 12, 'Shopping'),
(168, 6, -1, 'Urban Living'),
(7, -1, -1, 'News'),
(169, 7, -1, 'Alternative Media'),
(170, 7, -1, 'Columnists'),
(171, 7, -1, 'Current Events'),
(172, 7, -1, 'Magazines'),
(173, 7, -1, 'Media'),
(174, 7, -1, 'Newspapers'),
(175, 7, -1, 'Online'),
(176, 7, -1, 'Politics'),
(177, 7, -1, 'Satire'),
(178, 7, -1, 'Weather'),
(8, -1, -1, 'Recreation'),
(179, 8, -1, 'Air Hockey'),
(180, 8, -1, 'Amateur Radio'),
(181, 8, -1, 'Antiques'),
(182, 8, -1, 'Audio'),
(183, 8, -1, 'Aviation'),
(184, 8, -1, 'Birdwatching'),
(185, 8, -1, 'Boating'),
(186, 8, 310, 'Bowling'),
(187, 8, -1, 'Climbing'),
(188, 8, -1, 'Collecting'),
(189, 8, 23, 'Crafts'),
(190, 8, -1, 'Drugs'),
(191, 8, -1, 'Food and Drink'),
(192, 8, 4, 'Games'),
(193, 8, 156, 'Gardens'),
(194, 8, 285, 'Genealogy'),
(195, 8, -1, 'Guns'),
(196, 8, -1, 'Hot Air Ballooning'),
(197, 8, -1, 'Humor'),
(198, 8, -1, 'Kites'),
(199, 8, -1, 'Knives'),
(200, 8, -1, 'Living History'),
(201, 8, 332, 'Martial Arts'),
(202, 8, -1, 'Models'),
(203, 8, -1, 'Motorcycles'),
(204, 8, -1, 'Nudism'),
(205, 8, -1, 'Outdoors'),
(206, 8, -1, 'Parties'),
(207, 8, -1, 'Pets'),
(208, 8, -1, 'Roads and Highways'),
(209, 8, -1, 'Scouting'),
(210, 8, -1, 'Smoking'),
(211, 8, 14, 'Sports'),
(212, 8, -1, 'Theme Parks'),
(213, 8, -1, 'Trains and Railroads'),
(214, 8, -1, 'Travel'),
(9, -1, -1, 'Reference and Education'),
(215, 9, -1, 'Alumni'),
(216, 9, -1, 'Colleges and Universities'),
(217, 9, -1, 'Continuing Education'),
(218, 9, 79, 'Corporate Training'),
(219, 9, -1, 'Distance Learning'),
(220, 9, -1, 'International'),
(221, 9, -1, 'K through 12'),
(222, 9, -1, 'Libraries'),
(223, 9, -1, 'Museums'),
(224, 9, -1, 'Special Education'),
(225, 9, -1, 'Vocational Education'),
(10, -1, -1, 'Regional'),
(226, 10, -1, 'International'),
(227, 10, -1, 'US'),
(11, -1, -1, 'Science'),
(228, 11, -1, 'Agriculture'),
(229, 11, -1, 'Alternative Science'),
(230, 11, -1, 'Astronomy'),
(231, 11, -1, 'Biology'),
(232, 11, -1, 'Chemistry'),
(233, 11, -1, 'Earth Sciences'),
(234, 11, -1, 'Environment'),
(235, 11, -1, 'Mathematics'),
(236, 11, -1, 'Physics'),
(237, 11, -1, 'Science in Society'),
(238, 11, -1, 'Social Sciences'),
(239, 11, -1, 'Space'),
(240, 11, -1, 'Technology'),
(12, -1, -1, 'Shopping'),
(241, 12, -1, 'Antiques and Collectibles'),
(242, 12, -1, 'Auctions'),
(243, 12, -1, 'Books'),
(244, 12, -1, 'Children'),
(245, 12, -1, 'Classifieds'),
(246, 12, -1, 'Clothing'),
(247, 12, 103, 'Computers'),
(248, 12, -1, 'Consumer Electronics'),
(249, 12, -1, 'Crafts'),
(250, 12, -1, 'Entertainment'),
(251, 12, -1, 'Ethnic and Regional'),
(252, 12, -1, 'Flowers'),
(253, 12, -1, 'Food and Drink'),
(254, 12, -1, 'Furniture'),
(255, 12, -1, 'Gifts'),
(256, 12, -1, 'Health and Beauty'),
(257, 12, -1, 'Holidays'),
(258, 12, -1, 'Home and Garden'),
(259, 12, -1, 'Jewelry'),
(260, 12, -1, 'Music and Video'),
(261, 12, -1, 'Niche'),
(262, 12, -1, 'Office Products'),
(263, 12, -1, 'Pets'),
(264, 12, -1, 'Photography'),
(265, 12, -1, 'Recreation and Hobbies'),
(266, 12, -1, 'Religious'),
(267, 12, -1, 'Sports'),
(268, 12, -1, 'Tobacco'),
(269, 12, -1, 'Tools'),
(270, 12, -1, 'Toys and Games'),
(271, 12, -1, 'Travel'),
(272, 12, -1, 'Vehicles'),
(273, 12, -1, 'Visual Arts'),
(274, 12, -1, 'Weddings'),
(275, 12, -1, 'Wholesale'),
(13, -1, -1, 'Society'),
(276, 13, -1, 'Activism'),
(277, 13, -1, 'Advice'),
(278, 13, -1, 'Crime'),
(279, 13, -1, 'Death'),
(280, 13, -1, 'Disabled'),
(281, 13, -1, 'Ethnicity'),
(282, 13, -1, 'Folklore'),
(283, 13, -1, 'Future'),
(284, 13, -1, 'Gay/Lesbian/Bisexual'),
(285, 13, -1, 'Genealogy'),
(286, 13, -1, 'Government'),
(287, 13, -1, 'History'),
(288, 13, -1, 'Holidays'),
(289, 13, -1, 'Issues'),
(290, 13, -1, 'Law'),
(291, 13, -1, 'Lifestyle Choices'),
(292, 13, -1, 'Military'),
(293, 13, -1, 'Paranormal'),
(294, 13, -1, 'People'),
(295, 13, -1, 'Philosophy'),
(296, 13, -1, 'Politics'),
(297, 13, -1, 'Recovery and Support Groups'),
(298, 13, -1, 'Relationships'),
(299, 13, -1, 'Religion and Spirituality'),
(300, 13, -1, 'Sexuality'),
(301, 13, -1, 'Subcultures'),
(302, 13, -1, 'Transgendered'),
(303, 13, -1, 'Work'),
(14, -1, -1, 'Sports'),
(304, 14, -1, 'Archery'),
(305, 14, -1, 'Badminton'),
(306, 14, -1, 'Baseball'),
(307, 14, -1, 'Basketball'),
(308, 14, -1, 'Billiards'),
(309, 14, -1, 'Boomerang'),
(310, 14, -1, 'Bowling'),
(311, 14, -1, 'Boxing'),
(312, 14, -1, 'Cheerleading'),
(313, 14, -1, 'Cricket'),
(314, 14, -1, 'Croquet'),
(315, 14, -1, 'Cycling'),
(316, 14, -1, 'Darts'),
(317, 14, -1, 'Equestrian'),
(318, 14, -1, 'Extreme Sports'),
(319, 14, -1, 'Fantasy'),
(320, 14, -1, 'Fencing'),
(321, 14, -1, 'Fishing'),
(322, 14, -1, 'Flying Discs'),
(323, 14, -1, 'Football'),
(324, 14, -1, 'Golf'),
(325, 14, -1, 'Greyhound Racing'),
(326, 14, -1, 'Gymnastics'),
(327, 14, -1, 'Handball'),
(328, 14, -1, 'Hockey'),
(329, 14, -1, 'Lacrosse'),
(330, 14, -1, 'Laser Games'),
(331, 14, -1, 'Lumberjack'),
(332, 14, -1, 'Martial Arts'),
(333, 14, -1, 'Motor Sports'),
(334, 14, -1, 'Orienteering'),
(335, 14, -1, 'Paintball'),
(336, 14, -1, 'Racquetball'),
(337, 14, -1, 'Rodeo'),
(338, 14, -1, 'Roller Derby'),
(339, 14, -1, 'Rope Skipping'),
(340, 14, -1, 'Rugby'),
(341, 14, -1, 'Running'),
(342, 14, -1, 'Sailing'),
(343, 14, -1, 'Shooting'),
(344, 14, 267, 'Shopping'),
(345, 14, -1, 'Skateboarding'),
(346, 14, -1, 'Skating'),
(347, 14, -1, 'Skiing'),
(348, 14, -1, 'Sledding'),
(349, 14, -1, 'Sled Dog Racing'),
(350, 14, -1, 'Snowboarding'),
(351, 14, -1, 'Soccer'),
(352, 14, -1, 'Softball'),
(353, 14, -1, 'Squash'),
(354, 14, -1, 'Strength Sports'),
(355, 14, -1, 'Table Tennis'),
(356, 14, -1, 'Tennis'),
(357, 14, -1, 'Track and Field'),
(358, 14, -1, 'Volleyball'),
(359, 14, -1, 'Walking'),
(360, 14, -1, 'Water Sports'),
(361, 14, -1, 'Winter Sports'),
(362, 14, -1, 'Wrestling'),
(15, -1, -1, '***DEPRECATED***');
### -- LAST IS 363 -- ###
UPDATE refcategory SET dontuse = 1 WHERE catid = 15;
# Create the "global" menu. (ID #1)
INSERT INTO menus (menuid, menu_nsid, menu_name, title, subtitle)
VALUES (1, 1, 'fixed.menu', 'About This Site', NULL);
INSERT INTO menuitems (menuid, sequence, itemtype, text, linktype, link) VALUES
(1, 0, 'TEXT', 'Documentation', 'ABSOLUTE', 'TODO' ),
(1, 1, 'TEXT', 'About Venice', 'FRAME', 'about-venice.html' ),
(1, 2, 'TEXT', 'System Administration', 'SERVLET', 'sysadmin/main.js.vs');
UPDATE menuitems SET enable = 0 WHERE menuid = 1 AND sequence = 0;
UPDATE menuitems SET perm_nsid = 13, perm_name = 'show.admin.menu' WHERE menuid = 1 AND sequence = 2;
# Create the user profile menu. (ID #2)
INSERT INTO menus (menuid, menu_nsid, menu_name, title, subtitle)
VALUES (2, 11, 'user.profile.menu', '', NULL);
INSERT INTO menuvars (menuid, var_name, default_val)
VALUES (2, 'target', 'top.js.vs');
INSERT INTO menuitems (menuid, sequence, itemtype, text, linktype, link) VALUES
(2, 0, 'TEXT', 'Profile', 'SERVLET', 'profile.js.vs?tgt=${target}');
# Create the main system administration menu. (ID #3)
INSERT INTO menus (menuid, menu_nsid, menu_name, title, subtitle)
VALUES (3, 13, 'system.admin', 'System Administration', NULL);
INSERT INTO menuitems (menuid, sequence, itemtype, text, linktype, link, perm_nsid, perm_name) VALUES
(3, 0, 'TEXT', 'Set Frame Look-And-Feel Parameters', 'SERVLET', 'sysadmin/frame_laf.js.vs', 1,
'set.property'),
(3, 1, 'TEXT', 'Set E-Mail Parameters', 'SERVLET', 'sysadmin/email.js.vs', 5,
'set.property'),
(3, 2, 'TEXT', 'Set Session Parameters', 'SERVLET', 'sysadmin/session.js.vs', 7,
'set.property'),
(3, 3, 'TEXT', 'Edit Confirmation E-Mail Message', 'SERVLET', 'sysadmin/confirm_email.js.vs', 12,
'set.property'),
(3, 4, 'TEXT', 'Edit Password Changed E-Mail Message', 'SERVLET', 'sysadmin/pwchange_email.js.vs', 12,
'set.property'),
(3, 5, 'TEXT', 'Edit Password Reminder E-Mail Message', 'SERVLET', 'sysadmin/pwremind_email.js.vs', 12,
'set.property');
# Create the find submenu. (ID #4)
INSERT INTO menus (menuid, menu_nsid, menu_name, title, subtitle)
VALUES (4, 6, 'find.menu', 'Find', NULL);
INSERT INTO menuitems (menuid, sequence, itemtype, text, linktype, link) VALUES
(4, 0, 'TEXT', 'Categories', 'SERVLET', 'find_categories.js.vs');