AnsweredAssumed Answered

Current User info lookup

Question asked by fhomasp on Apr 2, 2008
Latest reply on Apr 3, 2008 by fhomasp

I need to lookup the firstname and lastname of the current user, using SDK.  The user logs on normally, has some out-of-the-box functionality but he/she can also go to a custom JSF - Bean page to adjust info.  However, I need to automatically lookup his first and last name so the Alfresco repo (using web service api) can lookup the specific info and populate the bean.  The user should only be able to view/adjust his/her own info.

This might be solved rather easy.  However I have written some kind of class that resolves in an ExceptionInInitializer exception when I redraw the page. I don't really know why and I'd like to know, as I want to learn a bit about Spring in the process.  So if anyone can enlighten me, by all means don't hold back ;-)

import javax.transaction.UserTransaction;

import net.sf.acegisecurity.AuthenticationManager;
import net.sf.acegisecurity.providers.dao.SaltSource;

import org.alfresco.repo.cache.SimpleCache;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.util.ApplicationContextHelper;
import org.springframework.context.ApplicationContext;

public class AuthCheck {
   private static ApplicationContext ctx = ApplicationContextHelper.getApplicationContext();
    private NodeService nodeService;
    private SearchService searchService;
    private NodeRef rootNodeRef;
    private NodeRef systemNodeRef;
    private NodeRef typesNodeRef;
    private NodeRef personAndyNodeRef;
    private DictionaryService dictionaryService;
    private MD4PasswordEncoder passwordEncoder;
    private MutableAuthenticationDao dao;
    private AuthenticationManager authenticationManager;
    private SaltSource saltSource;
    private TicketComponent ticketComponent;
    private SimpleCache<String, Ticket> ticketsCache;
    private AuthenticationService authenticationService;
    private AuthenticationService pubAuthenticationService;
    private AuthenticationComponent authenticationComponent;
    private UserTransaction userTransaction;
    private AuthenticationComponent authenticationComponentImpl;
    * This class checks the filled in user info. 
    * The idea is to use the LDAP.  Otherwise anyone can access anyones info and modify it.
   public AuthCheck() {

   public void setUp(){
   //   authenticationService = (AuthenticationService)ctx.getBean("authenticationService");
    //    pubAuthenticationService = (AuthenticationService)ctx.getBean("AuthenticationService");
    //    authenticationComponent = (AuthenticationComponent)ctx.getBean("authenticationComponent");
        authenticationComponentImpl = (AuthenticationComponent)ctx.getBean("authenticationComponentImpl");
        System.out.println(authenticationComponentImpl.getCurrentUserName()+ " From AuthCheck!!!!!");