Search in sources :

Example 6 with ITenantedPrincipleNameResolver

use of org.pentaho.platform.api.mt.ITenantedPrincipleNameResolver in project pentaho-platform by pentaho.

the class MockUserRoleDao method getPrincipalName.

protected String getPrincipalName(String principalId, boolean isUser) {
    String principalName = null;
    ITenantedPrincipleNameResolver nameUtils = isUser ? userNameResolver : roleNameResolver;
    if (nameUtils != null) {
        principalName = nameUtils.getPrincipleName(principalId);
    }
    return principalName;
}
Also used : ITenantedPrincipleNameResolver(org.pentaho.platform.api.mt.ITenantedPrincipleNameResolver)

Example 7 with ITenantedPrincipleNameResolver

use of org.pentaho.platform.api.mt.ITenantedPrincipleNameResolver in project pentaho-platform by pentaho.

the class DefaultUnifiedRepositoryBase method getPrincipalName.

protected String getPrincipalName(String principalId, boolean isUser) {
    String principalName = null;
    ITenantedPrincipleNameResolver nameUtils = isUser ? userNameUtils : roleNameUtils;
    if (nameUtils != null) {
        principalName = nameUtils.getPrincipleName(principalId);
    }
    return principalName;
}
Also used : ITenantedPrincipleNameResolver(org.pentaho.platform.api.mt.ITenantedPrincipleNameResolver)

Example 8 with ITenantedPrincipleNameResolver

use of org.pentaho.platform.api.mt.ITenantedPrincipleNameResolver in project pentaho-kettle by pentaho.

the class PurRepositoryIT method getTenant.

protected ITenant getTenant(String principalId, boolean isUser) {
    ITenant tenant = null;
    ITenantedPrincipleNameResolver nameUtils = isUser ? userNameUtils : roleNameUtils;
    if (nameUtils != null) {
        tenant = nameUtils.getTenant(principalId);
    }
    if (tenant == null || tenant.getId() == null) {
        tenant = getCurrentTenant();
    }
    return tenant;
}
Also used : ITenant(org.pentaho.platform.api.mt.ITenant) ITenantedPrincipleNameResolver(org.pentaho.platform.api.mt.ITenantedPrincipleNameResolver)

Example 9 with ITenantedPrincipleNameResolver

use of org.pentaho.platform.api.mt.ITenantedPrincipleNameResolver in project pentaho-kettle by pentaho.

the class UIEERepositoryDirectoryIT method getPrincipalName.

private String getPrincipalName(String principalId, boolean isUser) {
    String principalName = null;
    ITenantedPrincipleNameResolver nameUtils = isUser ? userNameUtils : roleNameUtils;
    if (nameUtils != null) {
        principalName = nameUtils.getPrincipleName(principalId);
    }
    return principalName;
}
Also used : ITenantedPrincipleNameResolver(org.pentaho.platform.api.mt.ITenantedPrincipleNameResolver)

Example 10 with ITenantedPrincipleNameResolver

use of org.pentaho.platform.api.mt.ITenantedPrincipleNameResolver in project pentaho-platform by pentaho.

the class AbstractJcrBackedUserRoleDaoTest method testConvertToPentahoUserDisableCache.

@Test
public void testConvertToPentahoUserDisableCache() throws RepositoryException {
    AbstractJcrBackedUserRoleDao abstractJcrBackedUserRoleDaoMock = mock(AbstractJcrBackedUserRoleDao.class);
    doCallRealMethod().when(abstractJcrBackedUserRoleDaoMock).convertToPentahoUser(nullable(User.class));
    ITenantedPrincipleNameResolver resolverMock = mock(ITenantedPrincipleNameResolver.class);
    when(abstractJcrBackedUserRoleDaoMock.getTenantedUserNameUtils()).thenReturn(resolverMock);
    // Cache mocking
    LRUMap cacheMock = mock(LRUMap.class);
    when(abstractJcrBackedUserRoleDaoMock.getUserCache()).thenReturn(cacheMock);
    User userMock = mock(User.class);
    abstractJcrBackedUserRoleDaoMock.convertToPentahoUser(userMock);
    verify(cacheMock, never()).put(any(), anyString());
}
Also used : IPentahoUser(org.pentaho.platform.api.engine.security.userroledao.IPentahoUser) User(org.apache.jackrabbit.api.security.user.User) LRUMap(org.apache.commons.collections.map.LRUMap) ITenantedPrincipleNameResolver(org.pentaho.platform.api.mt.ITenantedPrincipleNameResolver) Test(org.junit.Test)

Aggregations

ITenantedPrincipleNameResolver (org.pentaho.platform.api.mt.ITenantedPrincipleNameResolver)14 ITenant (org.pentaho.platform.api.mt.ITenant)7 LRUMap (org.apache.commons.collections.map.LRUMap)2 User (org.apache.jackrabbit.api.security.user.User)2 Test (org.junit.Test)2 IPentahoUser (org.pentaho.platform.api.engine.security.userroledao.IPentahoUser)2 Locale (java.util.Locale)1 Matchers.anyString (org.mockito.Matchers.anyString)1 IPentahoSession (org.pentaho.platform.api.engine.IPentahoSession)1 Tenant (org.pentaho.platform.core.mt.Tenant)1 UserSession (org.pentaho.platform.engine.core.system.UserSession)1 Authentication (org.springframework.security.core.Authentication)1