user.setUsername("mdamour1976");
session.save(user);
// create 100 files which have global read = true
for (int i = 0; i < 1; i++) {
PermissibleObject parent = new PermissibleObject();
parent.setName("globalRead:true " + i);
parent.setOwner(user);
parent.setGlobalRead(true);
session.save(parent);
for (int k = 0; k < 5; k++) {
PermissibleObject folder = new PermissibleObject();
folder.setName("globalRead:true " + i);
folder.setOwner(user);
folder.setGlobalRead(true);
folder.setParent(parent);
session.save(folder);
for (int z = 0; z < 5; z++) {
File file = new File();
file.setName("globalRead:true " + z);
file.setOwner(user);
file.setGlobalRead(true);
file.setParent(folder);
session.save(file);
}
}
}
User user2 = new User();
user2.setUsername("nobody");
session.save(user2);
for (int j = 0; j < 1; j++) {
File file = new File();
file.setName("HAS PERM " + j);
file.setOwner(user);
session.save(file);
Permission perm = new Permission();
perm.readPerm = true;
perm.setSecurityPrincipal(user2);
perm.setPermissibleObject(file);
session.save(perm);
}
for (int j = 0; j < 1; j++) {
PermissibleObject folder = new PermissibleObject();
folder.setName("HAS PERM " + j);
folder.setOwner(user);
session.save(folder);
Permission perm = new Permission();
perm.readPerm = true;
perm.setSecurityPrincipal(user2);
perm.setPermissibleObject(folder);
session.save(perm);
}
for (int j = 0; j < 1; j++) {
PermissibleObject folder = new PermissibleObject();
folder.setName("user owns, but does not have perm");
folder.setOwner(user2);
session.save(folder);
Permission perm = new Permission();
perm.setReadPerm(true);
perm.setSecurityPrincipal(user);