/**
* Bootstrap the initial Roles and their Permissions.
*/
private void bootstrapRoles() {
if (roleDAO.findRole(Roles.ADMIN_ROLE) == null) {
Role admin = new Role(Roles.ADMIN_ROLE, "Administrator Role");
admin.setPermissions(Permissions.ALL);
roleDAO.save(admin);
}
if (roleDAO.findRole(Roles.DEVELOPER_ROLE) == null) {
Role dev = new Role(Roles.DEVELOPER_ROLE, "Developer Role");
dev.addPermissions(Permissions.APP_USER);
roleDAO.save(dev);
}
if (roleDAO.findRole(Roles.USER_ROLE) == null) {
Role user = new Role(Roles.USER_ROLE, "Required Role to Login");
user.addPermissions(Permissions.APP_USER);
roleDAO.save(user);
}
}