use of eu.etaxonomy.cdm.model.permission.CdmAuthority in project cdmlib by cybertaxonomy.
the class CdmAuthorityDaoHibernateImplTest method testSave.
@Test
public void testSave() {
CdmAuthority authority = CdmAuthority.NewInstance(PermissionClass.AGENTBASE, "property", Operation.CREATE, uuidAuthority1);
authorityDao.save(authority);
}
use of eu.etaxonomy.cdm.model.permission.CdmAuthority in project cdmlib by cybertaxonomy.
the class FullCoverageDataGenerator method createSupplemental.
private void createSupplemental(List<CdmBase> cdmBases) {
Reference ref = ReferenceFactory.newBook();
Annotation annotation = Annotation.NewDefaultLanguageInstance("annotation");
ref.addAnnotation(annotation);
handleAnnotatableEntity(annotation);
Credit credit = Credit.NewInstance(Person.NewInstance(), "refCredit", "rc", Language.DEFAULT());
ref.addCredit(credit);
handleAnnotatableEntity(credit);
Rights rights = Rights.NewInstance("My rights", Language.GERMAN());
ref.addRights(rights);
handleAnnotatableEntity(rights);
// Others
try {
LSIDAuthority lsidAuthority = new LSIDAuthority("My authority");
lsidAuthority.addNamespace("lsidNamespace", TaxonName.class);
cdmBases.add(lsidAuthority);
} catch (MalformedLSIDException e) {
e.printStackTrace();
}
User user = User.NewInstance("myUser", "12345");
Group group = Group.NewInstance("MyGroup");
group.addMember(user);
CdmAuthority authority = CdmAuthority.NewInstance(PermissionClass.TAXONNAME, "a property", Operation.CREATE, UUID.fromString("f1653cb8-5956-429e-852a-4a3b57893f49"));
group.addAuthority(authority);
Role role = Role.NewInstance("my role");
user.addAuthority(role);
cdmBases.add(user);
cdmBases.add(group);
cdmBases.add(authority);
cdmBases.add(ref);
}
use of eu.etaxonomy.cdm.model.permission.CdmAuthority in project cdmlib by cybertaxonomy.
the class CdmAuthorityDaoHibernateImplTest method testLoad.
@Test
@DataSet
public void testLoad() {
CdmAuthority authority = authorityDao.load(uuidAuthority1);
Assert.assertNotNull(authority);
Assert.assertTrue(authority.getOperations().contains(CRUD.CREATE));
User user = userDao.load(1, null);
Assert.assertNotNull(user);
Assert.assertEquals(authority, user.getAuthoritiesB().iterator().next());
}
Aggregations