Search in sources :

Example 16 with Tenant

use of org.camunda.bpm.engine.identity.Tenant in project camunda-bpm-platform by camunda.

the class DefaultPermissionForTenantMemberTest method createTenant.

protected Tenant createTenant(String tenantId) {
    Tenant newTenant = identityService.newTenant(tenantId);
    identityService.saveTenant(newTenant);
    return newTenant;
}
Also used : Tenant(org.camunda.bpm.engine.identity.Tenant)

Example 17 with Tenant

use of org.camunda.bpm.engine.identity.Tenant in project camunda-bpm-platform by camunda.

the class IdentityServiceTenantTest method createTenantGroupMembershipAlreadyExisting.

@Test
public void createTenantGroupMembershipAlreadyExisting() {
    Tenant tenant = identityService.newTenant(TENANT_ONE);
    identityService.saveTenant(tenant);
    Group group = identityService.newGroup(GROUP_ONE);
    identityService.saveGroup(group);
    identityService.createTenantGroupMembership(TENANT_ONE, GROUP_ONE);
    thrown.expect(ProcessEngineException.class);
    identityService.createTenantGroupMembership(TENANT_ONE, GROUP_ONE);
}
Also used : Group(org.camunda.bpm.engine.identity.Group) Tenant(org.camunda.bpm.engine.identity.Tenant) Test(org.junit.Test)

Example 18 with Tenant

use of org.camunda.bpm.engine.identity.Tenant in project camunda-bpm-platform by camunda.

the class IdentityServiceTenantTest method createTenantMembershipUnexistingGroup.

@Test
public void createTenantMembershipUnexistingGroup() {
    Tenant tenant = identityService.newTenant(TENANT_ONE);
    identityService.saveTenant(tenant);
    thrown.expect(ProcessEngineException.class);
    thrown.expectMessage("No group found with id 'nonExisting'.");
    identityService.createTenantGroupMembership(tenant.getId(), "nonExisting");
}
Also used : Tenant(org.camunda.bpm.engine.identity.Tenant) Test(org.junit.Test)

Example 19 with Tenant

use of org.camunda.bpm.engine.identity.Tenant in project camunda-bpm-platform by camunda.

the class IdentityServiceTenantTest method deleteTenantMembershipsWileDeleteUser.

@Test
public void deleteTenantMembershipsWileDeleteUser() {
    Tenant tenant = identityService.newTenant(TENANT_ONE);
    identityService.saveTenant(tenant);
    User user = identityService.newUser(USER_ONE);
    identityService.saveUser(user);
    identityService.createTenantUserMembership(TENANT_ONE, USER_ONE);
    TenantQuery query = identityService.createTenantQuery().userMember(USER_ONE);
    assertThat(query.count(), is(1L));
    identityService.deleteUser(USER_ONE);
    assertThat(query.count(), is(0L));
}
Also used : Tenant(org.camunda.bpm.engine.identity.Tenant) User(org.camunda.bpm.engine.identity.User) TenantQuery(org.camunda.bpm.engine.identity.TenantQuery) Test(org.junit.Test)

Example 20 with Tenant

use of org.camunda.bpm.engine.identity.Tenant in project camunda-bpm-platform by camunda.

the class IdentityServiceTenantTest method updateTenantOptimisticLockingException.

@Test
public void updateTenantOptimisticLockingException() {
    // create
    Tenant tenant = identityService.newTenant(TENANT_ONE);
    identityService.saveTenant(tenant);
    Tenant tenant1 = identityService.createTenantQuery().singleResult();
    Tenant tenant2 = identityService.createTenantQuery().singleResult();
    // update
    tenant1.setName("name");
    identityService.saveTenant(tenant1);
    thrown.expect(ProcessEngineException.class);
    // fail to update old revision
    tenant2.setName("other name");
    identityService.saveTenant(tenant2);
}
Also used : Tenant(org.camunda.bpm.engine.identity.Tenant) Test(org.junit.Test)

Aggregations

Tenant (org.camunda.bpm.engine.identity.Tenant)47 Test (org.junit.Test)24 AuthorizationException (org.camunda.bpm.engine.AuthorizationException)10 TenantQuery (org.camunda.bpm.engine.identity.TenantQuery)10 Authorization (org.camunda.bpm.engine.authorization.Authorization)9 Group (org.camunda.bpm.engine.identity.Group)9 MissingAuthorization (org.camunda.bpm.engine.authorization.MissingAuthorization)8 User (org.camunda.bpm.engine.identity.User)8 Matchers.anyString (org.mockito.Matchers.anyString)7 InvalidRequestException (org.camunda.bpm.engine.rest.exception.InvalidRequestException)6 ArrayList (java.util.ArrayList)5 TenantEntity (org.camunda.bpm.engine.impl.persistence.entity.TenantEntity)3 IdentityService (org.camunda.bpm.engine.IdentityService)2 RepositoryService (org.camunda.bpm.engine.RepositoryService)2 GroupQuery (org.camunda.bpm.engine.identity.GroupQuery)2 AuthorizationServiceImpl (org.camunda.bpm.engine.impl.AuthorizationServiceImpl)2 IdentityServiceImpl (org.camunda.bpm.engine.impl.IdentityServiceImpl)2 Before (org.junit.Before)2 AuthorizationService (org.camunda.bpm.engine.AuthorizationService)1 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)1