/*==============================================================*/
/* View: CATEGORIES_READABLE_BY_USER                            */
/*==============================================================*/

CREATE VIEW CATEGORIES_READABLE_BY_USER (
  CATEGORYID,
  USERID
) AS SELECT
  CATEGORIES.CATEGORYID,
  CATEGORYACLS.ACCESSORID
FROM
  CATEGORIES, CATEGORYACLS
WHERE
  CATEGORIES.ACLID = CATEGORYACLS.ACLID AND ( CATEGORYACLS.ACLTYPEID=1 OR CATEGORYACLS.ACLTYPEID=3 ) AND CATEGORYACLS.PERMISSIONID = 2;

/*==============================================================*/
/* View: CATEGORIES_READABLE_BY_GROUP                           */
/*==============================================================*/
CREATE VIEW CATEGORIES_READABLE_BY_GROUP (
  CATEGORYID,
  GROUPID
) AS SELECT
  CATEGORIES.CATEGORYID,
  CATEGORYACLS.ACCESSORID
FROM
  CATEGORIES, CATEGORYACLS
WHERE
  CATEGORIES.ACLID = CATEGORYACLS.ACLID AND CATEGORYACLS.ACLTYPEID=2 AND CATEGORYACLS.PERMISSIONID = 2;

update SYSPARAMETERS set VALUESTRING = '62' where CONTEXT = 'SYSTEMINFO' and name = 'DBVersionLow';
update SYSPARAMETERS set VALUESTRING = '2004-03-25' where CONTEXT = 'SYSTEMINFO' and name = 'DBCreationDate';
commit;