1 Reply Latest reply on Oct 6, 2010 10:12 AM by hanspeter

    Access OrganizationService

    cblumenro

      All,

       

      within a portlet visible to not authenticated users I want to access the OrganizationService to get some user information. How do I retrieve the service when I'm not logged in? Somehow

       

      OrganizationService orgService = (OrganizationService)PortalContainer.getInstance().getComponentInstanceOfType(OrganizationService.class);

       

      seems not to work in this case.

       

      Any thoughts?

        • 1. Re: Access OrganizationService
          hanspeter

          .. for me this works:

           

                    WebuiRequestContext context = WebuiRequestContext.getCurrentInstance();
                    ExoContainer container = context.getApplication().getApplicationServiceContainer();
               

                    OrganizationService orgService = (OrganizationService) container.getComponentInstanceOfType(OrganizationService.class);
                   
                    User user = null;
                    try {
                        user = orgService.getUserHandler().findUserByName("XYZ");
                        ..

                        ..

                        } catch (Exception e) {
                      // TODO Auto-generated catch block
                      e.printStackTrace();
                      }
                    

             hope this helps