protected IUserProfile getUserProfile( HttpServletRequest request, IPerson person, LocaleManager localeManager, String userAgent) { final String profileFname = profileMapper.getProfileFname(person, request); IUserProfile userProfile = userLayoutStore.getUserProfileByFname(person, profileFname); if (userProfile == null) { userProfile = userLayoutStore.getSystemProfileByFname(profileFname); } if (localeManager != null && localeManagerFactory.isLocaleAware()) { userProfile.setLocaleManager(localeManager); } return userProfile; }
/** * Provides a {@link Tuple} containing the "fragmentized" version of a DLM fragment * owner's layout, together with the username. This version of the layout consistent with what * DLM uses internally for fragments, and is created by FragmentActivator.fragmentizeLayout. * It's important that the version returned by this method matches what DLM uses internally * because it will be used to establish relationships between fragment layout nodes and user * customizations of DLM fragments. * * @param userId * @return */ /* TODO: make private */ Tuple<String, DistributedUserLayout> getUserLayoutTuple( String userName, int userId) { final PersonImpl person = new PersonImpl(); person.setUserName(userName); person.setID(userId); person.setSecurityContext(new BrokenSecurityContext()); final IUserProfile profile = layoutStore.getUserProfileByFname(person, UserProfile.DEFAULT_PROFILE_FNAME); final DistributedUserLayout userLayout = layoutStore.getUserLayout(person, (UserProfile) profile); return new Tuple<String, DistributedUserLayout>(userName, userLayout); } }
/** * @param personAttributes * @see * org.apereo.portal.layout.IUserLayoutHelper#resetUserLayout(org.apereo.services.persondir.IPersonAttributes) */ @BasePortalJpaDao.PortalTransactional @Override public void resetUserLayout(final IPersonAttributes personAttributes) { // Create an empty RestrictedPerson object final IPerson person = PersonFactory.createRestrictedPerson(); // populate the person with the supplied attributes person.setAttributes(personAttributes.getAttributes()); // get the integer uid into the person object without creating any new person data final int uid = userIdentityStore.getPortalUID(person, false); person.setID(uid); final IUserProfile profile = userLayoutStore.getUserProfileByFname(person, DEFAULT_LAYOUT_FNAME); resetUserLayoutForProfileByName(person, profile); resetStylesheetUserPreferencesForProfile(person, profile); }
IUserProfile profile = userLayoutStore.getUserProfileByFname(owner, "default"); final LocaleManager localeManager = localeManagerFactory.createLocaleManager(
@Override protected Element exportDataElement(String userName) { final Integer userId = this.userIdentityStore.getPortalUserId(userName); if (userId == null) { this.logger.warn("No user " + userName + " found, no layout will be exported"); return null; } // Setup empty IPerson used to interact with the layout store final PersonImpl person = new PersonImpl(); person.setUserName(userName); person.setID(userId); person.setSecurityContext(new BrokenSecurityContext()); try { this.userLayoutStore.setProfileImportExportCache(layoutCache); this.userLayoutStore.setLayoutImportExportCache(profileCache); final IUserProfile userProfile = userLayoutStore.getUserProfileByFname( person, UserProfile.DEFAULT_PROFILE_FNAME); final Element layoutElement = userLayoutStore.exportLayout(person, userProfile); return layoutElement; } finally { this.userLayoutStore.setProfileImportExportCache(null); this.userLayoutStore.setLayoutImportExportCache(null); } } }