dbinit.txt 3.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. --- $Id$
  2. SET IGNORECASE TRUE;
  3. CREATE TABLE users (
  4. username VARCHAR(50) NOT NULL PRIMARY KEY,
  5. password VARCHAR(50) NOT NULL,
  6. enabled BIT NOT NULL
  7. );
  8. CREATE TABLE authorities (
  9. username VARCHAR(50) NOT NULL,
  10. authority VARCHAR(50) NOT NULL
  11. );
  12. CREATE UNIQUE INDEX ix_auth_username ON authorities ( username, authority );
  13. ALTER TABLE authorities ADD CONSTRAINT fk_authorities_users foreign key (username) REFERENCES users(username);
  14. INSERT INTO users VALUES ('marissa', 'koala', true);
  15. INSERT INTO users VALUES ('dianne', 'emu', true);
  16. INSERT INTO users VALUES ('scott', 'wombat', true);
  17. INSERT INTO users VALUES ('peter', 'opal', false);
  18. INSERT INTO authorities VALUES ('marissa', 'ROLE_TELLER');
  19. INSERT INTO authorities VALUES ('marissa', 'ROLE_SUPERVISOR');
  20. INSERT INTO authorities VALUES ('dianne', 'ROLE_TELLER');
  21. INSERT INTO authorities VALUES ('scott', 'ROLE_TELLER');
  22. INSERT INTO authorities VALUES ('peter', 'ROLE_TELLER');
  23. --- Indexes auto created in HSQLDB for primary keys and unique columns
  24. CREATE TABLE acl_object_identity (
  25. id IDENTITY NOT NULL,
  26. object_identity VARCHAR_IGNORECASE(250) NOT NULL,
  27. parent_object INTEGER,
  28. acl_class VARCHAR_IGNORECASE(250) NOT NULL,
  29. CONSTRAINT unique_object_identity UNIQUE(object_identity),
  30. FOREIGN KEY (parent_object) REFERENCES acl_object_identity(id)
  31. );
  32. CREATE TABLE acl_permission (
  33. id IDENTITY NOT NULL,
  34. acl_object_identity INTEGER NOT NULL,
  35. recipient VARCHAR_IGNORECASE(100) NOT NULL,
  36. mask INTEGER NOT NULL,
  37. CONSTRAINT unique_recipient UNIQUE(acl_object_identity, recipient),
  38. FOREIGN KEY (acl_object_identity) REFERENCES acl_object_identity(id)
  39. );
  40. --- Mask integer 0 = no permissions
  41. --- Mask integer 1 = administer
  42. --- Mask integer 2 = read
  43. --- Mask integer 6 = read and write permissions
  44. --- Mask integer 14 = read and write and create permissions
  45. ---------------------------------------------------------------------
  46. --- *** INHERITED RIGHTS FOR DIFFERENT INSTANCES AND RECIPIENTS ***
  47. --- INSTANCE RECIPIENT PERMISSION(S) (COMMENT #INSTANCE)
  48. ---------------------------------------------------------------------
  49. --- 1 ROLE_SUPERVISOR Administer
  50. --- 2 ROLE_SUPERVISOR None (overrides parent #1)
  51. --- marissa Read
  52. --- 3 ROLE_SUPERVISOR Administer (from parent #1)
  53. --- scott Read, Write, Create
  54. --- 4 ROLE_SUPERVISOR Administer (from parent #1)
  55. --- 5 ROLE_SUPERVISOR Administer (from parent #3)
  56. --- scott Read, Write, Create (from parent #3)
  57. --- 6 ROLE_SUPERVISOR Administer (from parent #3)
  58. --- scott Administer (overrides parent #3)
  59. ---------------------------------------------------------------------
  60. INSERT INTO acl_object_identity VALUES (1, 'net.sf.acegisecurity.acl.DomainObject:1', null, 'net.sf.acegisecurity.acl.basic.SimpleAclEntry');
  61. INSERT INTO acl_object_identity VALUES (2, 'net.sf.acegisecurity.acl.DomainObject:2', 1, 'net.sf.acegisecurity.acl.basic.SimpleAclEntry');
  62. INSERT INTO acl_object_identity VALUES (3, 'net.sf.acegisecurity.acl.DomainObject:3', 1, 'net.sf.acegisecurity.acl.basic.SimpleAclEntry');
  63. INSERT INTO acl_object_identity VALUES (4, 'net.sf.acegisecurity.acl.DomainObject:4', 1, 'net.sf.acegisecurity.acl.basic.SimpleAclEntry');
  64. INSERT INTO acl_object_identity VALUES (5, 'net.sf.acegisecurity.acl.DomainObject:5', 3, 'net.sf.acegisecurity.acl.basic.SimpleAclEntry');
  65. INSERT INTO acl_object_identity VALUES (6, 'net.sf.acegisecurity.acl.DomainObject:6', 3, 'net.sf.acegisecurity.acl.basic.SimpleAclEntry');
  66. INSERT INTO acl_permission VALUES (null, 1, 'ROLE_SUPERVISOR', 1);
  67. INSERT INTO acl_permission VALUES (null, 2, 'ROLE_SUPERVISOR', 0);
  68. INSERT INTO acl_permission VALUES (null, 2, 'marissa', 2);
  69. INSERT INTO acl_permission VALUES (null, 3, 'scott', 14);
  70. INSERT INTO acl_permission VALUES (null, 6, 'scott', 1);