Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
164 lines (154 sloc) 6.723 kB
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog/1.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog/1.9
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-1.9.xsd">
<changeSet id="1" author="meri">
<comment>
Create table structure for users, passwords, roles and permissions.
</comment>
<createTable tableName="sec_users">
<column name="name" type="varchar(150)">
<constraints primaryKey="true" nullable="false" />
</column>
<column name="password" type="varchar(1500)">
<constraints nullable="false" />
</column>
<column name="salt" type="varchar(1500)">
<constraints nullable="false" />
</column>
</createTable>
<createTable tableName="sec_roles">
<column name="name" type="varchar(150)">
<constraints primaryKey="true" nullable="false" />
</column>
<column name="description" type="varchar(1500)">
</column>
</createTable>
<createTable tableName="sec_users_roles">
<column name="role_name" type="varchar(150)">
<constraints nullable="false" />
</column>
<column name="user_name" type="varchar(150)">
<constraints nullable="false" />
</column>
</createTable>
<addForeignKeyConstraint constraintName="fk_users_roles_roles"
baseTableName="sec_users_roles" baseColumnNames="role_name"
referencedTableName="sec_roles" referencedColumnNames="name" />
<addForeignKeyConstraint constraintName="fk_users_roles_users"
baseTableName="sec_users_roles" baseColumnNames="user_name"
referencedTableName="sec_users" referencedColumnNames="name" />
<createTable tableName="sec_roles_permissions">
<column name="role_name" type="varchar(150)">
<constraints nullable="false" />
</column>
<column name="permissions" type="varchar(1500)">
<constraints nullable="false" />
</column>
</createTable>
<addForeignKeyConstraint constraintName="fk_users_permissions_roles"
baseTableName="sec_roles_permissions" baseColumnNames="role_name"
referencedTableName="sec_roles" referencedColumnNames="name" />
</changeSet>
<changeSet id="2" author="meri" context="test">
<comment>
Create initial users, roles and permissions.
</comment>
<insert tableName="sec_users">
<column name="name" value="administrator" />
<column name="password" value="0c630af79f3c3d0534f6fa5127682deecba489f57579ccc624f476d5dc7a479b" />
<column name="salt" value="random_salt_value_administrator" />
</insert>
<insert tableName="sec_users">
<column name="name" value="friendlyrepairman" />
<column name="password" value="ab7cce1a3ea3b29ad6c0cf14ca30b62bcb758f1569270e9cfbc08c6233a782ad" />
<column name="salt" value="random_salt_value_friendlyrepairman" />
</insert>
<insert tableName="sec_users">
<column name="name" value="unfriendlyrepairman" />
<column name="password" value="181adb37929544f5210c2f114f5304150077d4599de6f787bd5e2355b0fc0b16" />
<column name="salt" value="random_salt_value_unfriendlyrepairman" />
</insert>
<insert tableName="sec_users">
<column name="name" value="mathematician" />
<column name="password" value="e468b296641a8c51265155c54d0ca873978e99b04f240c8e07a2f513b69c0e02" />
<column name="salt" value="random_salt_value_mathematician" />
</insert>
<insert tableName="sec_users">
<column name="name" value="physicien" />
<column name="password" value="13c81aa93d59f79eaeadf432b59db6ea6b62879b4673e3b610d4b3cbf05587db" />
<column name="salt" value="random_salt_value_physicien" />
</insert>
<insert tableName="sec_users">
<column name="name" value="productsales" />
<column name="password" value="893a5217ce89e843090723897fec02e4ba7fa62f808c85c10f7b3a23e8313e5c" />
<column name="salt" value="random_salt_value_productsales" />
</insert>
<insert tableName="sec_users">
<column name="name" value="servicessales" />
<column name="password" value="faf8392c66ed7ec97401bb5eab09a60f687fedefd801f0caf07e3f261486a5e9" />
<column name="salt" value="random_salt_value_servicessales" />
</insert>
<insert tableName="sec_roles">
<column name="name" value="Administrator" />
<column name="description" value="Used for company admins." />
</insert>
<insert tableName="sec_roles">
<column name="name" value="repairman" />
<column name="description" value="Can repaire stuff." />
</insert>
<insert tableName="sec_roles">
<column name="name" value="scientist" />
<column name="description" value="Anybody on reserche positions." />
</insert>
<insert tableName="sec_roles">
<column name="name" value="sales" />
<column name="description" value="Members are selling stuff." />
</insert>
<insert tableName="sec_users_roles">
<column name="user_name" value="administrator" />
<column name="role_name" value="Administrator" />
</insert>
<insert tableName="sec_users_roles">
<column name="user_name" value="friendlyrepairman" />
<column name="role_name" value="repairman" />
</insert>
<insert tableName="sec_users_roles">
<column name="user_name" value="unfriendlyrepairman" />
<column name="role_name" value="repairman" />
</insert>
<insert tableName="sec_users_roles">
<column name="user_name" value="mathematician" />
<column name="role_name" value="scientist" />
</insert>
<insert tableName="sec_users_roles">
<column name="user_name" value="physicien" />
<column name="role_name" value="scientist" />
</insert>
<insert tableName="sec_users_roles">
<column name="user_name" value="productsales" />
<column name="role_name" value="sales" />
</insert>
<insert tableName="sec_users_roles">
<column name="user_name" value="servicessales" />
<column name="role_name" value="sales" />
</insert>
<insert tableName="sec_roles_permissions">
<column name="role_name" value="sales" />
<column name="permissions" value="functions:sale:*" />
</insert>
<insert tableName="sec_roles_permissions">
<column name="role_name" value="scientist" />
<column name="permissions" value="functions:science:*" />
</insert>
<insert tableName="sec_roles_permissions">
<column name="role_name" value="repairman" />
<column name="permissions" value="functions:repair:*" />
</insert>
<insert tableName="sec_roles_permissions">
<column name="role_name" value="Administrator" />
<column name="permissions" value="functions:manage:*,functions:repair:*" />
</insert>
</changeSet>
</databaseChangeLog>
Jump to Line
Something went wrong with that request. Please try again.