admin.setSignupDate(System.currentTimeMillis());
admin.setAdministrator(true);
admin.setValidated(true);
session.save(admin);
UserGroup group = new UserGroup();
group.setName("admin-group");
group.setOwner(admin);
session.save(group);
GroupMembership membership = new GroupMembership();
membership.setUser(admin);
membership.setUserGroup(group);
session.save(membership);
File f = new File();
f.setName("Test File");
f.setOwner(admin);
session.save(f);
}
User anonymous = UserHelper.getUser(session, "anonymous");
if (anonymous == null) {
anonymous = new User();
anonymous.setUsername("anonymous");
MD5 md5 = new MD5();
md5.Update("s,!5C6xAwM");
anonymous.setPasswordHash(md5.asHex());
anonymous.setFirstname("anonymous");
anonymous.setLastname("anonymous");
anonymous.setPasswordHint("default");
anonymous.setSignupDate(System.currentTimeMillis());
anonymous.setAdministrator(false);
anonymous.setValidated(true);
session.save(anonymous);
UserGroup group = new UserGroup();
group.setName("anonymous-group");
group.setOwner(anonymous);
session.save(group);
GroupMembership membership = new GroupMembership();
membership.setUser(anonymous);
membership.setUserGroup(group);