SEC-272: Added group tables to test DB.
This commit is contained in:
parent
d19fe54c01
commit
274658f9b0
|
@ -29,7 +29,7 @@ import javax.sql.DataSource;
|
|||
*/
|
||||
public class PopulatedDatabase {
|
||||
//~ Static fields/initializers =====================================================================================
|
||||
|
||||
|
||||
private static DriverManagerDataSource dataSource = null;
|
||||
|
||||
//~ Constructors ===================================================================================================
|
||||
|
@ -98,5 +98,33 @@ public class PopulatedDatabase {
|
|||
template.execute("INSERT INTO acl_permission VALUES (null, 2, 'marissa', 2);");
|
||||
template.execute("INSERT INTO acl_permission VALUES (null, 3, 'scott', 14);");
|
||||
template.execute("INSERT INTO acl_permission VALUES (null, 6, 'scott', 1);");
|
||||
|
||||
// Group tables and data
|
||||
template.execute(
|
||||
"CREATE TABLE GROUPS(ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 0) PRIMARY KEY, GROUP_NAME VARCHAR_IGNORECASE(50) NOT NULL)");
|
||||
template.execute(
|
||||
"CREATE TABLE GROUP_AUTHORITIES(GROUP_ID BIGINT NOT NULL, AUTHORITY VARCHAR(50) NOT NULL, CONSTRAINT FK_GROUP_AUTHORITIES_GROUP FOREIGN KEY(GROUP_ID) REFERENCES GROUPS(ID))");
|
||||
template.execute(
|
||||
"CREATE TABLE GROUP_MEMBERS(ID BIGINT GENERATED BY DEFAULT AS IDENTITY(START WITH 0) PRIMARY KEY, USERNAME VARCHAR(50) NOT NULL, GROUP_ID BIGINT NOT NULL, CONSTRAINT FK_GROUP_MEMBERS_GROUP FOREIGN KEY(GROUP_ID) REFERENCES GROUPS(ID))");
|
||||
|
||||
template.execute("INSERT INTO USERS VALUES('jerry','password',TRUE)");
|
||||
template.execute("INSERT INTO USERS VALUES('tom','password',TRUE)");
|
||||
|
||||
template.execute("INSERT INTO GROUPS VALUES (0, 'GROUP_ZERO')");
|
||||
template.execute("INSERT INTO GROUPS VALUES (1, 'GROUP_ONE')");
|
||||
template.execute("INSERT INTO GROUPS VALUES (2, 'GROUP_TWO')");
|
||||
|
||||
template.execute("INSERT INTO GROUP_AUTHORITIES VALUES (0, 'ROLE_A')");
|
||||
template.execute("INSERT INTO GROUP_AUTHORITIES VALUES (1, 'ROLE_B')");
|
||||
template.execute("INSERT INTO GROUP_AUTHORITIES VALUES (1, 'ROLE_C')");
|
||||
template.execute("INSERT INTO GROUP_AUTHORITIES VALUES (2, 'ROLE_A')");
|
||||
template.execute("INSERT INTO GROUP_AUTHORITIES VALUES (2, 'ROLE_B')");
|
||||
template.execute("INSERT INTO GROUP_AUTHORITIES VALUES (2, 'ROLE_C')");
|
||||
|
||||
template.execute("INSERT INTO GROUP_MEMBERS VALUES (0, 'jerry', 0)");
|
||||
template.execute("INSERT INTO GROUP_MEMBERS VALUES (1, 'jerry', 1)");
|
||||
// tom has groups with overlapping roles
|
||||
template.execute("INSERT INTO GROUP_MEMBERS VALUES (2, 'tom', 1)");
|
||||
template.execute("INSERT INTO GROUP_MEMBERS VALUES (3, 'tom', 2)");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue