Search in sources :

Example 1 with CacheProjectGroup

use of org.ligoj.app.model.CacheProjectGroup in project ligoj-api by ligoj.

the class SubscriptionResourceTest method prepareDelegate.

private DelegateOrg prepareDelegate() {
    // Persist the delegate and the related group to the project
    final CacheProjectGroup projectGroup = new CacheProjectGroup();
    final CacheGroup group = new CacheGroup();
    group.setId("group-project");
    group.setName("group-project");
    group.setDescription("cn=group-project,ou=parent");
    em.persist(group);
    final CacheMembership membership = new CacheMembership();
    membership.setGroup(group);
    membership.setUser(em.find(CacheUser.class, "fdaugan"));
    em.persist(membership);
    projectGroup.setGroup(group);
    projectGroup.setProject(repository.findOne(subscription).getProject());
    em.persist(projectGroup);
    final DelegateOrg delegate = new DelegateOrg();
    delegate.setReceiver("fdaugan");
    delegate.setReceiverType(ReceiverType.USER);
    delegate.setReceiverDn("uid=fdaugan,ou=company");
    delegate.setType(DelegateType.GROUP);
    delegate.setName("group-project");
    delegate.setDn("cn=group-project,ou=parent");
    em.persist(delegate);
    em.flush();
    return delegate;
}
Also used : CacheProjectGroup(org.ligoj.app.model.CacheProjectGroup) CacheGroup(org.ligoj.app.iam.model.CacheGroup) DelegateOrg(org.ligoj.app.iam.model.DelegateOrg) CacheMembership(org.ligoj.app.iam.model.CacheMembership) CacheUser(org.ligoj.app.iam.model.CacheUser)

Aggregations

CacheGroup (org.ligoj.app.iam.model.CacheGroup)1 CacheMembership (org.ligoj.app.iam.model.CacheMembership)1 CacheUser (org.ligoj.app.iam.model.CacheUser)1 DelegateOrg (org.ligoj.app.iam.model.DelegateOrg)1 CacheProjectGroup (org.ligoj.app.model.CacheProjectGroup)1