Search in sources :

Example 6 with TenantService

use of org.alfresco.repo.tenant.TenantService in project alfresco-repository by Alfresco.

the class UpgradePasswordHashTest method setUp.

public void setUp() throws Exception {
    if (AlfrescoTransactionSupport.getTransactionReadState() != TxnReadState.TXN_NONE) {
        throw new AlfrescoRuntimeException("A previous tests did not clean up transaction: " + AlfrescoTransactionSupport.getTransactionId());
    }
    serviceRegistry = (ServiceRegistry) ctx.getBean("ServiceRegistry");
    SimpleCache<String, RepositoryAuthenticationDao.CacheEntry> authenticationCache = (SimpleCache<String, RepositoryAuthenticationDao.CacheEntry>) ctx.getBean("authenticationCache");
    SimpleCache<String, NodeRef> immutableSingletonCache = (SimpleCache<String, NodeRef>) ctx.getBean("immutableSingletonCache");
    TenantService tenantService = (TenantService) ctx.getBean("tenantService");
    compositePasswordEncoder = (CompositePasswordEncoder) ctx.getBean("compositePasswordEncoder");
    PolicyComponent policyComponent = (PolicyComponent) ctx.getBean("policyComponent");
    repositoryAuthenticationDao = new RepositoryAuthenticationDao();
    repositoryAuthenticationDao.setTransactionService(serviceRegistry.getTransactionService());
    repositoryAuthenticationDao.setAuthorityService(serviceRegistry.getAuthorityService());
    repositoryAuthenticationDao.setTenantService(tenantService);
    repositoryAuthenticationDao.setNodeService(serviceRegistry.getNodeService());
    repositoryAuthenticationDao.setNamespaceService(serviceRegistry.getNamespaceService());
    repositoryAuthenticationDao.setCompositePasswordEncoder(compositePasswordEncoder);
    repositoryAuthenticationDao.setPolicyComponent(policyComponent);
    repositoryAuthenticationDao.setAuthenticationCache(authenticationCache);
    repositoryAuthenticationDao.setSingletonCache(immutableSingletonCache);
    upgradePasswordHashWorker = (UpgradePasswordHashWorker) ctx.getBean("upgradePasswordHashWorker");
    nodeService = serviceRegistry.getNodeService();
    AuthenticationUtil.setFullyAuthenticatedUser(AuthenticationUtil.getSystemUserName());
}
Also used : NodeRef(org.alfresco.service.cmr.repository.NodeRef) TenantService(org.alfresco.repo.tenant.TenantService) PolicyComponent(org.alfresco.repo.policy.PolicyComponent) SimpleCache(org.alfresco.repo.cache.SimpleCache) AlfrescoRuntimeException(org.alfresco.error.AlfrescoRuntimeException)

Example 7 with TenantService

use of org.alfresco.repo.tenant.TenantService in project alfresco-remote-api by Alfresco.

the class WebDAVHelper method determineTenantDomain.

public String determineTenantDomain() {
    TenantService tenantService = getTenantService();
    String tenantDomain = tenantService.getCurrentUserDomain();
    if (tenantDomain == null) {
        return TenantService.DEFAULT_DOMAIN;
    }
    return tenantDomain;
}
Also used : TenantService(org.alfresco.repo.tenant.TenantService)

Example 8 with TenantService

use of org.alfresco.repo.tenant.TenantService in project acs-community-packaging by Alfresco.

the class Repository method getIsGuest.

/**
 * @return true if we are currently the special Guest user
 */
public static boolean getIsGuest(FacesContext context) {
    TenantService tenantService = (TenantService) FacesContextUtils.getRequiredWebApplicationContext(context).getBean("tenantService");
    String userName = Application.getCurrentUser(context).getUserName();
    return tenantService.getBaseNameUser(userName).equalsIgnoreCase(AuthenticationUtil.getGuestUserName());
}
Also used : TenantService(org.alfresco.repo.tenant.TenantService)

Example 9 with TenantService

use of org.alfresco.repo.tenant.TenantService in project alfresco-repository by Alfresco.

the class NodeChangeTest method newPath.

@SuppressWarnings("serial")
private Path newPath(Path parent, final String name) {
    Path path = new Path();
    if (parent != null) {
        for (Path.Element element : parent) {
            path.append(element);
        }
    }
    path.append(new Path.Element() {

        @Override
        public String getElementString() {
            return name;
        }

        @Override
        public Element getBaseNameElement(TenantService tenantService) {
            return this;
        }
    });
    return path;
}
Also used : Path(org.alfresco.service.cmr.repository.Path) Element(org.alfresco.service.cmr.repository.Path.Element) TenantService(org.alfresco.repo.tenant.TenantService) Element(org.alfresco.service.cmr.repository.Path.Element) ArgumentMatchers.anyString(org.mockito.ArgumentMatchers.anyString)

Example 10 with TenantService

use of org.alfresco.repo.tenant.TenantService in project alfresco-repository by Alfresco.

the class DictionaryDAOTest method setUp.

@Before
public void setUp() throws Exception {
    // register resource bundles for messages
    I18NUtil.registerResourceBundle(TEST_RESOURCE_MESSAGES);
    // Instantiate Dictionary Service
    TenantService tenantService = new MultiTServiceImpl();
    this.dictionaryDAO = new DictionaryDAOImpl();
    dictionaryDAO.setTenantService(tenantService);
    initDictionaryCaches(dictionaryDAO, tenantService);
    new AuthenticationUtil().afterPropertiesSet();
    // Populate with appropriate models
    DictionaryBootstrap bootstrap = new DictionaryBootstrap();
    List<String> bootstrapModels = new ArrayList<String>();
    bootstrapModels.add("alfresco/model/dictionaryModel.xml");
    bootstrapModels.add("alfresco/model/systemModel.xml");
    bootstrapModels.add("alfresco/model/contentModel.xml");
    List<String> labels = new ArrayList<String>();
    bootstrap.setModels(bootstrapModels);
    bootstrap.setLabels(labels);
    bootstrap.setDictionaryDAO(dictionaryDAO);
    bootstrap.setTenantService(tenantService);
    bootstrap.bootstrap();
    DictionaryComponent component = new DictionaryComponent();
    component.setDictionaryDAO(dictionaryDAO);
    component.setMessageLookup(new StaticMessageLookup());
    service = component;
}
Also used : TenantService(org.alfresco.repo.tenant.TenantService) MultiTServiceImpl(org.alfresco.repo.tenant.MultiTServiceImpl) AuthenticationUtil(org.alfresco.repo.security.authentication.AuthenticationUtil) StaticMessageLookup(org.alfresco.repo.i18n.StaticMessageLookup) ArrayList(java.util.ArrayList) Before(org.junit.Before)

Aggregations

TenantService (org.alfresco.repo.tenant.TenantService)14 ArrayList (java.util.ArrayList)9 SingleTServiceImpl (org.alfresco.repo.tenant.SingleTServiceImpl)7 DictionaryComponent (org.alfresco.repo.dictionary.DictionaryComponent)3 DictionaryDAOImpl (org.alfresco.repo.dictionary.DictionaryDAOImpl)3 StaticMessageLookup (org.alfresco.repo.i18n.StaticMessageLookup)3 DictionaryBootstrap (org.alfresco.repo.dictionary.DictionaryBootstrap)2 AuthenticationUtil (org.alfresco.repo.security.authentication.AuthenticationUtil)2 MultiTServiceImpl (org.alfresco.repo.tenant.MultiTServiceImpl)2 NodeRef (org.alfresco.service.cmr.repository.NodeRef)2 Before (org.junit.Before)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 InputStream (java.io.InputStream)1 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)1 AlfrescoRuntimeException (org.alfresco.error.AlfrescoRuntimeException)1 CMISDictionaryRegistry (org.alfresco.opencmis.dictionary.CMISDictionaryRegistry)1 CMISStrictDictionaryService (org.alfresco.opencmis.dictionary.CMISStrictDictionaryService)1 CMISMapping (org.alfresco.opencmis.mapping.CMISMapping)1 RuntimePropertyLuceneBuilderMapping (org.alfresco.opencmis.mapping.RuntimePropertyLuceneBuilderMapping)1