barTarget.setName("Bar");
barTarget.addPattern(".*nexu.537/repo.-bar.*");
barTarget = this.targetUtil.createTarget(barTarget);
// now create a couple privs
PrivilegeResource fooPriv = new PrivilegeResource();
fooPriv.addMethod("create");
fooPriv.addMethod("read");
fooPriv.addMethod("update");
fooPriv.addMethod("delete");
fooPriv.setName("FooPriv");
fooPriv.setType(TargetPrivilegeDescriptor.TYPE);
fooPriv.setRepositoryTargetId(fooTarget.getId());
fooPriv.setRepositoryId("repo1");
// get the Resource object
List<PrivilegeStatusResource> fooPrivs = this.privUtil.createPrivileges(fooPriv);
for (Iterator<PrivilegeStatusResource> iter = fooPrivs.iterator(); iter.hasNext(); ) {
PrivilegeStatusResource privilegeBaseStatusResource = iter.next();
if (getSecurityConfigUtil().getPrivilegeProperty(privilegeBaseStatusResource,
ApplicationPrivilegeMethodPropertyDescriptor.ID).equals("create,read")) {
fooPrivCreateId = privilegeBaseStatusResource.getId();
}
else if (getSecurityConfigUtil().getPrivilegeProperty(privilegeBaseStatusResource,
ApplicationPrivilegeMethodPropertyDescriptor.ID).equals("read")) {
fooPrivReadId = privilegeBaseStatusResource.getId();
}
else if (getSecurityConfigUtil().getPrivilegeProperty(privilegeBaseStatusResource,
ApplicationPrivilegeMethodPropertyDescriptor.ID).equals("update,read")) {
fooPrivUpdateId = privilegeBaseStatusResource.getId();
}
else if (getSecurityConfigUtil().getPrivilegeProperty(privilegeBaseStatusResource,
ApplicationPrivilegeMethodPropertyDescriptor.ID).equals("delete,read")) {
fooPrivDeleteId = privilegeBaseStatusResource.getId();
}
else {
Assert.fail("Unknown Privilege found, id: "
+ privilegeBaseStatusResource.getId()
+ " method: "
+ getSecurityConfigUtil().getPrivilegeProperty(privilegeBaseStatusResource,
ApplicationPrivilegeMethodPropertyDescriptor.ID));
}
}
// now create a couple privs
PrivilegeResource barPriv = new PrivilegeResource();
barPriv.addMethod("create");
barPriv.addMethod("read");
barPriv.addMethod("update");
barPriv.addMethod("delete");
barPriv.setName("BarPriv");
barPriv.setType(TargetPrivilegeDescriptor.TYPE);
barPriv.setRepositoryTargetId(barTarget.getId());
barPriv.setRepositoryId("repo1");
// get the Resource object
List<PrivilegeStatusResource> barPrivs = this.privUtil.createPrivileges(barPriv);
for (Iterator<PrivilegeStatusResource> iter = barPrivs.iterator(); iter.hasNext(); ) {
PrivilegeStatusResource privilegeBaseStatusResource = iter.next();
if (getSecurityConfigUtil().getPrivilegeProperty(privilegeBaseStatusResource,
ApplicationPrivilegeMethodPropertyDescriptor.ID).equals("create,read")) {
barPrivCreateId = privilegeBaseStatusResource.getId();
}
else if (getSecurityConfigUtil().getPrivilegeProperty(privilegeBaseStatusResource,
ApplicationPrivilegeMethodPropertyDescriptor.ID).equals("read")) {
barPrivReadId = privilegeBaseStatusResource.getId();
}
else if (getSecurityConfigUtil().getPrivilegeProperty(privilegeBaseStatusResource,
ApplicationPrivilegeMethodPropertyDescriptor.ID).equals("update,read")) {
barPrivUpdateId = privilegeBaseStatusResource.getId();
}
else if (getSecurityConfigUtil().getPrivilegeProperty(privilegeBaseStatusResource,
ApplicationPrivilegeMethodPropertyDescriptor.ID).equals("delete,read")) {
barPrivDeleteId = privilegeBaseStatusResource.getId();
}
else {
Assert.fail("Unknown Privilege found, id: "
+ privilegeBaseStatusResource.getId()
+ " method: "
+ getSecurityConfigUtil().getPrivilegeProperty(privilegeBaseStatusResource,
ApplicationPrivilegeMethodPropertyDescriptor.ID));
}
}
// now create a couple privs
PrivilegeResource groupPriv = new PrivilegeResource();
groupPriv.addMethod("create");
groupPriv.addMethod("read");
groupPriv.addMethod("update");
groupPriv.addMethod("delete");
groupPriv.setName("GroupPriv");
groupPriv.setType(TargetPrivilegeDescriptor.TYPE);
groupPriv.setRepositoryTargetId(fooTarget.getId());
groupPriv.setRepositoryGroupId(GROUP_ID);
// groupPriv.setRepositoryId( repositoryId )
// groupPriv.setName( name )
// groupPriv.setDescription( description )
// get the Resource object