use of org.olat.basesecurity.Invitation in project openolat by klemens.
the class InvitationDAOTest method findInvitation_group.
@Test
public void findInvitation_group() {
Invitation invitation = invitationDao.createAndPersistInvitation();
Group baseGroup = invitation.getBaseGroup();
Assert.assertNotNull(invitation);
dbInstance.commitAndCloseSession();
Invitation reloadedInvitation = invitationDao.findInvitation(baseGroup);
Assert.assertNotNull(reloadedInvitation);
Assert.assertNotNull(reloadedInvitation.getKey());
Assert.assertEquals(baseGroup, reloadedInvitation.getBaseGroup());
Assert.assertEquals(invitation, reloadedInvitation);
Assert.assertEquals(invitation.getToken(), reloadedInvitation.getToken());
}
use of org.olat.basesecurity.Invitation in project openolat by klemens.
the class InvitationDAOTest method loadOrCreateIdentityAndPersistInvitation.
@Test
public void loadOrCreateIdentityAndPersistInvitation() {
Invitation invitation = invitationDao.createAndPersistInvitation();
String uuid = UUID.randomUUID().toString().replace("-", "");
invitation = invitationDao.update(invitation, "Flora", uuid, uuid + "@frentix.com");
Group group = groupDao.createGroup();
dbInstance.commit();
// use the create part of the method
Identity identity = invitationDao.loadOrCreateIdentityAndPersistInvitation(invitation, group, Locale.ENGLISH);
Assert.assertNotNull(identity);
Assert.assertNotNull(identity.getKey());
dbInstance.commitAndCloseSession();
// reload and check
Identity reloadIdentity = securityManager.loadIdentityByKey(identity.getKey());
Assert.assertNotNull(reloadIdentity);
Assert.assertNotNull(reloadIdentity.getUser());
Assert.assertEquals(identity.getKey(), reloadIdentity.getKey());
Assert.assertEquals("Flora", reloadIdentity.getUser().getFirstName());
Assert.assertEquals(uuid, reloadIdentity.getUser().getLastName());
Assert.assertEquals(uuid + "@frentix.com", reloadIdentity.getUser().getEmail());
}
use of org.olat.basesecurity.Invitation in project openolat by klemens.
the class InvitationDAOTest method createAndPersistInvitation.
@Test
public void createAndPersistInvitation() {
Invitation invitation = invitationDao.createAndPersistInvitation();
Assert.assertNotNull(invitation);
dbInstance.commit();
Assert.assertNotNull(invitation);
Assert.assertNotNull(invitation.getKey());
Assert.assertNotNull(invitation.getBaseGroup());
Assert.assertNotNull(invitation.getToken());
}
use of org.olat.basesecurity.Invitation in project openolat by klemens.
the class EPPolicyManager method applyPolicy.
private List<EPStructureElementToGroupRelation> applyPolicy(EPMapPolicy policy, PortfolioStructureMap map) {
List<EPStructureElementToGroupRelation> savedPolicies = new ArrayList<EPStructureElementToGroupRelation>();
switch(policy.getType()) {
case user:
savedPolicies.add(applyPolicyToUsers(policy, map));
break;
case group:
for (BusinessGroup group : policy.getGroups()) {
savedPolicies.add(applyPolicyToGroup(group.getBaseGroup(), policy, map));
}
break;
case invitation:
Invitation invitation = policy.getInvitation();
EPStructureElementToGroupRelation invitationPolicy = applyPolicyToInvitation(invitation, policy, map);
savedPolicies.add(invitationPolicy);
break;
case allusers:
EPStructureElementToGroupRelation allUsersPolicy = applyPolicyToAllUsers(policy, map);
savedPolicies.add(allUsersPolicy);
break;
}
return savedPolicies;
}
use of org.olat.basesecurity.Invitation in project openolat by klemens.
the class InvitationDAO method deleteInvitation.
/**
* Delete an invitation
* @param invitation
*/
public void deleteInvitation(Invitation invitation) {
if (invitation == null || invitation.getKey() == null)
return;
Invitation refInvitation = dbInstance.getCurrentEntityManager().getReference(InvitationImpl.class, invitation.getKey());
dbInstance.getCurrentEntityManager().remove(refInvitation);
}
Aggregations