use of org.ligoj.app.iam.model.DelegateOrg in project ligoj-api by ligoj.
the class DelegateOrgResourceTest method createDelegateCompanyReceiverCompany.
@Test
public void createDelegateCompanyReceiverCompany() {
initSpringSecurityContext("mtuyer");
final DelegateOrgEditionVo vo = new DelegateOrgEditionVo();
vo.setName("InG");
vo.setType(DelegateType.COMPANY);
vo.setReceiver("ing");
vo.setReceiverType(ReceiverType.COMPANY);
vo.setCanAdmin(true);
final int id = resource.create(vo);
em.flush();
em.clear();
final DelegateOrg entity = repository.findOneExpected(id);
Assertions.assertEquals("ing", entity.getName());
Assertions.assertEquals("ou=ing,ou=external,ou=people,dc=sample,dc=com", entity.getDn());
Assertions.assertEquals(DelegateType.COMPANY, entity.getType());
Assertions.assertEquals("mtuyer", entity.getCreatedBy());
Assertions.assertEquals("ing", entity.getReceiver());
Assertions.assertEquals(ReceiverType.COMPANY, entity.getReceiverType());
Assertions.assertEquals("ou=ing,ou=external,ou=people,dc=sample,dc=com", entity.getReceiverDn());
Assertions.assertTrue(entity.isCanAdmin());
}
use of org.ligoj.app.iam.model.DelegateOrg in project ligoj-api by ligoj.
the class DelegateOrgResourceTest method createDelegateCompany.
@Test
public void createDelegateCompany() {
final DelegateOrgEditionVo vo = new DelegateOrgEditionVo();
vo.setName("socygan");
vo.setType(DelegateType.COMPANY);
vo.setReceiver("fdaugan");
vo.setCanAdmin(true);
vo.setCanWrite(true);
final int id = resource.create(vo);
em.flush();
em.clear();
final DelegateOrg entity = repository.findOneExpected(id);
Assertions.assertEquals("socygan", entity.getName());
Assertions.assertEquals("ou=socygan,ou=external,ou=people,dc=sample,dc=com", entity.getDn());
Assertions.assertNull(entity.getReceiverDn());
Assertions.assertEquals(DelegateType.COMPANY, entity.getType());
Assertions.assertEquals(DEFAULT_USER, entity.getCreatedBy());
Assertions.assertEquals("fdaugan", entity.getReceiver());
Assertions.assertEquals(ReceiverType.USER, entity.getReceiverType());
Assertions.assertTrue(entity.isCanWrite());
Assertions.assertTrue(entity.isCanAdmin());
}
use of org.ligoj.app.iam.model.DelegateOrg in project ligoj-api by ligoj.
the class DelegateOrgResourceTest method updateToSubTree.
@Test
public void updateToSubTree() {
initSpringSecurityContext("mtuyer");
final DelegateOrgEditionVo vo = new DelegateOrgEditionVo();
vo.setName("cn=any,ou=fonction,ou=groups,dc=sample,dc=com");
vo.setReceiver("mtuyer");
final DelegateOrg entity = updateNoChangeBase("mtuyer", vo);
Assertions.assertTrue(entity.isCanAdmin());
Assertions.assertFalse(entity.isCanWrite());
}
use of org.ligoj.app.iam.model.DelegateOrg in project ligoj-api by ligoj.
the class DelegateOrgResourceTest method createOnSubTree.
@Test
public void createOnSubTree() {
final DelegateOrgEditionVo vo = new DelegateOrgEditionVo();
vo.setName("cn=Any,dc=sample,dc=com");
vo.setReceiver("fdaugan");
vo.setType(DelegateType.TREE);
final int id = resource.create(vo);
em.flush();
em.clear();
final DelegateOrg entity = repository.findOneExpected(id);
Assertions.assertEquals("-", entity.getName());
Assertions.assertEquals("cn=any,dc=sample,dc=com", entity.getDn());
Assertions.assertEquals(DelegateType.TREE, entity.getType());
Assertions.assertEquals(DEFAULT_USER, entity.getCreatedBy());
Assertions.assertEquals("fdaugan", entity.getReceiver());
Assertions.assertEquals(ReceiverType.USER, entity.getReceiverType());
Assertions.assertFalse(entity.isCanWrite());
Assertions.assertFalse(entity.isCanWrite());
}
use of org.ligoj.app.iam.model.DelegateOrg in project ligoj-api by ligoj.
the class DelegateOrgResourceTest method updateNoChangeFromAnother.
@Test
public void updateNoChangeFromAnother() {
final DelegateOrgEditionVo vo = new DelegateOrgEditionVo();
vo.setName("ou=fonction,ou=groups,dc=sample,dc=com");
vo.setReceiver("fdaugan");
vo.setCanWrite(true);
final DelegateOrg entity = updateNoChangeBase("fdaugan", vo);
Assertions.assertTrue(entity.isCanWrite());
Assertions.assertTrue(entity.isCanAdmin());
}
Aggregations