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

    Access OrganizationService

    Nic Essling Newbie



      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
          Hans Peter Newbie

          .. 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

             hope this helps