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());
}
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;
}
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());
}
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;
}
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;
}
Aggregations