Package org.exoplatform.services.organization

Examples of org.exoplatform.services.organization.UserProfile


         uiUserInfo.getChild(UIUserProfileInputSet.class).save(service, uiUserInfo.getUserName(), false);

         if (uiUserInfo.getUserName().equals(event.getRequestContext().getRemoteUser()))
         {
            UserProfileHandler hanlder = service.getUserProfileHandler();
            UserProfile userProfile = hanlder.findUserProfileByName(event.getRequestContext().getRemoteUser());
            String language = userProfile.getAttribute(Constants.USER_LANGUAGE);

            UIPortalApplication uiApp = Util.getUIPortalApplication();           
            if (language == null || language.trim().length() < 1)
               return;
            LocaleConfigService localeConfigService =
               event.getSource().getApplicationComponent(LocaleConfigService.class);
            LocaleConfig localeConfig = localeConfigService.getLocaleConfig(language);
            if (localeConfig == null)
               localeConfig = localeConfigService.getDefaultLocaleConfig();
            uiApp.setLocale(localeConfig.getLocale());
            uiApp.setOrientation(localeConfig.getOrientation());
            uiApp.localizeNavigations();

            Util.getPortalRequestContext().addUIComponentToUpdateByAjax(
               uiApp.findFirstComponentOfType(UIWorkingWorkspace.class));
            Util.getPortalRequestContext().setFullRender(true);
         }
        
         UIUserManagement userManagement = uiUserInfo.getParent();
         UIListUsers listUser = userManagement.getChild(UIListUsers.class);
         UIAccountEditInputSet accountInput = uiUserInfo.getChild(UIAccountEditInputSet.class);
         UIUserProfileInputSet userProfile = uiUserInfo.getChild(UIUserProfileInputSet.class);
         uiUserInfo.setRenderSibling(UIListUsers.class);
         listUser.search(new Query());
         accountInput.reset();
         userProfile.reset();
         event.getRequestContext().setProcessRender(true);
      }
View Full Code Here


        String user = context.getRemoteUser();
        String portalSkin = null;
        OrganizationService orgService = getApplicationComponent(OrganizationService.class);

        if (user != null) {
            UserProfile userProfile = orgService.getUserProfileHandler().findUserProfileByName(user);
            if (userProfile != null) {
                portalSkin = userProfile.getUserInfoMap().get(Constants.USER_SKIN);
            } else {
                if (log.isWarnEnabled())
                    log.warn("Could not load user profile for " + user + ". Using default portal locale.");
            }
        }
View Full Code Here

        updateUIFields();
        super.processRender(context);
    }

    private void updateUIFields() {
        UserProfile userProfile = (UserProfile)Util.getPortalRequestContext().getAttribute(UserProfileLifecycle.USER_PROFILE_ATTRIBUTE_NAME);

        if (userProfile == null) {
            return;
        }

        for (OAuthProviderType oauthPrType : getOAuthProviderTypes()) {
            String usernameAttrName = oauthPrType.getUserNameAttrName();
            String oauthUsername = userProfile.getAttribute(usernameAttrName);
            getUIStringInput(usernameAttrName).setValue(oauthUsername);
        }
    }
View Full Code Here

            ConversationState state = ConversationState.getCurrent();
            String userName = ((User) state.getAttribute(CacheUserProfileFilter.USER_PROFILE)).getUserName();
            User user = service.getUserHandler().findUserByName(userName);

            if (user != null) {
                UserProfile userProfile = (UserProfile)prContext.getAttribute(UserProfileLifecycle.USER_PROFILE_ATTRIBUTE_NAME);

                String unlinkProviderKey = prContext.getRequestParameter(PARAM_PROVIDER_FOR_UNLINK);
                OAuthProviderType<AccessTokenContext> oauthProviderTypeToUnlink = uiForm.getApplicationComponent(OAuthProviderTypeRegistry.class).getOAuthProvider(unlinkProviderKey, AccessTokenContext.class);

                // Obtain current accessToken
                AccessTokenContext accessToken = uiForm.getApplicationComponent(SocialNetworkService.class).getOAuthAccessToken(oauthProviderTypeToUnlink, userName);

                // Unlink social account in userProfile (AccessTokenInvalidationListener will automatically remove accessToken)
                if (oauthProviderTypeToUnlink != null) {
                    userProfile.setAttribute(oauthProviderTypeToUnlink.getUserNameAttrName(), null);
                } else {
                    log.warn("Social account field to unlink not found");
                }
                service.getUserProfileHandler().saveUserProfile(userProfile, true);
View Full Code Here

            ExoContainer container = context.getApplication().getApplicationServiceContainer();
            OrganizationService svc = (OrganizationService) container.getComponentInstanceOfType(OrganizationService.class);

            // Don't rely on UserProfileLifecycle loaded UserProfile when doing
            // an update to avoid a potential overwrite of other changes
            UserProfile userProfile = svc.getUserProfileHandler().findUserProfileByName(context.getRemoteUser());
            if (userProfile != null && userProfile.getUserInfoMap() != null) {
                // Only save if user's locale has not been set
                String currLocale = userProfile.getUserInfoMap().get(Constants.USER_LANGUAGE);
                if (currLocale == null || currLocale.trim().equals("")) {
                    userProfile.getUserInfoMap().put(Constants.USER_LANGUAGE,
                            LocaleContextInfo.getLocaleAsString(context.getLocale()));
                    svc.getUserProfileHandler().saveUserProfile(userProfile, false);
                }
            }
        }
View Full Code Here

        if (preferencesPortletContext == null) {
            return null;
        }

        // get the user profile cached in the prc during the start of the request
        UserProfile userProfile = (UserProfile) prc.getAttribute(UserProfileLifecycle.USER_PROFILE_ATTRIBUTE_NAME);

        // client context
        AbstractClientContext clientContext;
        Cookie[] cookies = servletRequest.getCookies();
        if (cookies != null) {
View Full Code Here

                PortalRequestContext portalRequestContext = Util.getPortalRequestContext();

                // Save OAuth username as part of user profile of new user
                OrganizationService orgService = uiRegisterForm.getApplicationComponent(OrganizationService.class);
                UserProfileHandler profileHandler = orgService.getUserProfileHandler();
                UserProfile newUserProfile = profileHandler.findUserProfileByName(newUser.getUserName());

                AuthenticationRegistry authRegistry = uiRegisterForm.getApplicationComponent(AuthenticationRegistry.class);
                HttpServletRequest httpRequest = portalRequestContext.getRequest();
                OAuthPrincipal oauthPrincipal = (OAuthPrincipal)authRegistry.getAttributeOfClient(httpRequest, OAuthConstants.ATTRIBUTE_AUTHENTICATED_OAUTH_PRINCIPAL);

                newUserProfile.setAttribute(oauthPrincipal.getOauthProviderType().getUserNameAttrName(), oauthPrincipal.getUserName());
                try {
                    profileHandler.saveUserProfile(newUserProfile, true);
                } catch (OAuthException gtnOAuthException) {
                    // Show warning message if user with this facebookUsername (or googleUsername) already exists
                    // NOTE: It could happen only in case of parallel registration of same oauth user from more browser windows
View Full Code Here

        // TODO dang.tung - change layout when portal get language from UIPortal
        // (user and browser not support)
        // ----------------------------------------------------------------------------------------------------
        String portalAppLanguage = prContext.getLocale().getLanguage();
        OrganizationService orgService = getApplicationComponent(OrganizationService.class);
        UserProfile userProfile = orgService.getUserProfileHandler().findUserProfileByName(remoteUser);
        String userLanguage = userProfile.getUserInfoMap().get(Constants.USER_LANGUAGE);
        String browserLanguage = prContext.getRequest().getLocale().getLanguage();

        // in case: edit current portal, set skin and language for uiPortalApp
        if (uiPortal == null) {
            if (!portalAppLanguage.equals(userLanguage) && !portalAppLanguage.equals(browserLanguage)) {
View Full Code Here

   {
      Session session = service_.openSession();
      try
      {
         UserProfileData upd = (UserProfileData)service_.findExactOne(session, queryFindUserProfileByName, userName);
         UserProfile profile = upd.getUserProfile();
         if (broadcast)
            preDelete(profile);

         session.delete(upd);
         session.flush();
View Full Code Here

   /**
    * {@inheritDoc}
    */
   public UserProfile findUserProfileByName(String userName) throws Exception
   {
      UserProfile up = (UserProfile)cache_.get(userName);
      if (up != null)
      {
         if (NOT_FOUND == up) //NOSONAR
         {
            return null;
View Full Code Here

TOP

Related Classes of org.exoplatform.services.organization.UserProfile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.