Package org.jasig.portal.user

Examples of org.jasig.portal.user.IUserInstance


        this.localeStore = localeStore;
    }
   
    @Override
    public Locale resolveLocale(HttpServletRequest request) {
        final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request);
        final LocaleManager localeManager = userInstance.getLocaleManager();
       
        Locale[] locales = localeManager.getLocales();
        if (locales != null && locales.length > 0) {
            return locales[0];
        }
View Full Code Here


        return request.getLocale();
    }
   
    @Override
    public void setLocale(HttpServletRequest request, HttpServletResponse response, Locale locale) {
        final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request);
        final LocaleManager localeManager = userInstance.getLocaleManager();
        localeManager.setSessionLocales(new Locale[] { locale });
       
        // if the current user is logged in, also update the persisted user locale
        final IUserInstance ui = userInstanceManager.getUserInstance(request);
        final IPerson person = ui.getPerson();
        if (!person.isGuest()) {
            try {
                localeManager.persistUserLocales(new Locale[] { locale });
                localeStore.updateUserLocales(person, new Locale[] { locale });
                final IUserPreferencesManager upm = ui.getPreferencesManager();
                upm.getUserLayoutManager().loadUserLayout();
            } catch (Exception e) {
                throw new PortalException(e);
            }
        }
View Full Code Here

   * @param request
   * @return
   */
  public Locale getCurrentUserLocale(PortletRequest request) {
      final HttpServletRequest originalPortalRequest = this.portalRequestUtils.getPortletHttpRequest(request);
    IUserInstance ui = userInstanceManager.getUserInstance(originalPortalRequest);
    IUserPreferencesManager upm = ui.getPreferencesManager();
    final IUserProfile userProfile = upm.getUserProfile();
        LocaleManager localeManager = userProfile.getLocaleManager();
       
        // first check the session locales
        Locale[] sessionLocales = localeManager.getSessionLocales();
View Full Code Here

   * @param request
   * @param localeString
   */
  public void updateUserLocale(HttpServletRequest request, String localeString) {

    IUserInstance ui = userInstanceManager.getUserInstance(request);
    IUserPreferencesManager upm = ui.getPreferencesManager();
        final IUserProfile userProfile = upm.getUserProfile();
        LocaleManager localeManager = userProfile.getLocaleManager();


        if (localeString != null) {
         
          // build a new Locale[] array from the specified locale
            Locale userLocale = parseLocale(localeString);
            Locale[] locales = new Locale[] { userLocale };
           
            // set this locale in the session
            localeManager.setSessionLocales(locales);
           
            // if the current user is logged in, also update the persisted
            // user locale
            final IPerson person = ui.getPerson();
            if (!person.isGuest()) {
                try {
                    localeManager.persistUserLocales(new Locale[] { userLocale });
                    localeStore.updateUserLocales(person, new Locale[] { userLocale });
                   
View Full Code Here

      e.printStackTrace();
      return null;
    }
   
    // get the CasSecurityContext
        final IUserInstance userInstance = userInstanceManager.getUserInstance(httpServletRequest);
        final IPerson person = userInstance.getPerson();
    final ISecurityContext context = person.getSecurityContext();
    if (context == null) {
      log.error("no security context, no proxy ticket passed to the portlet");
      return null;
    }
View Full Code Here

    public Principal getUserPrincipal() {
        if (super.getSession(false) == null) {
            return super.getUserPrincipal();
        }
       
        final IUserInstance userInstance = this.userInstanceManager.getUserInstance(this.getWrappedRequest());
        final IPerson person = userInstance.getPerson();
        if (person == null || person.isGuest()) {
            return null;
        }
       
        return person;
View Full Code Here

           
            groupForRole = GroupService.getGroupMember(results[0]);
        }

        //Load the group information about the current user
        final IUserInstance userInstance = this.userInstanceManager.getUserInstance(this.getWrappedRequest());
        final IPerson person = userInstance.getPerson();
        final EntityIdentifier personEntityId = person.getEntityIdentifier();
        final IGroupMember personGroupMember = GroupService.getGroupMember(personEntityId);
       
        return personGroupMember.isDeepMemberOf(groupForRole);
    }
View Full Code Here

    public Locale getLocale() {
        if (super.getSession(false) == null) {
            return super.getLocale();
        }
       
        final IUserInstance userInstance = this.userInstanceManager.getUserInstance(this.getWrappedRequest());
        final LocaleManager localeManager = userInstance.getLocaleManager();
        final Locale[] locales = localeManager.getLocales();
        return locales[0];
    }
View Full Code Here

    public Enumeration<Locale> getLocales() {
        if (super.getSession(false) == null) {
            return super.getLocales();
        }
       
        final IUserInstance userInstance = this.userInstanceManager.getUserInstance(this.getWrappedRequest());
        final LocaleManager localeManager = userInstance.getLocaleManager();
        final Locale[] locales = localeManager.getLocales();
        return new ArrayEnumerator<Locale>(locales);
    }
View Full Code Here

        return this.urlNodeSyntaxHelpers.get(name);
    }

    @Override
    public IUrlNodeSyntaxHelper getCurrentUrlNodeSyntaxHelper(HttpServletRequest request) {
        final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request);
        final IUserPreferencesManager preferencesManager = userInstance.getPreferencesManager();
        final IUserProfile userProfile = preferencesManager.getUserProfile();
       
        final int themeStylesheetId = userProfile.getThemeStylesheetId();
        final IUrlNodeSyntaxHelper themeUrlSyntaxHelper = getUrlNodeSyntaxHelperForStylesheet(themeStylesheetId);
        if (themeUrlSyntaxHelper != null) {
View Full Code Here

TOP

Related Classes of org.jasig.portal.user.IUserInstance

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.