use of org.apereo.portal.security.IPerson in project uPortal by Jasig.
the class UserLayoutHelperImpl method resetUserLayout.
/**
* @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);
}
use of org.apereo.portal.security.IPerson in project uPortal by Jasig.
the class UserLayoutHelperImpl method resetUserLayoutAllProfiles.
/**
* Resets a users layout for all the users profiles
*
* @param personAttributes
*/
@BasePortalJpaDao.PortalTransactional
public void resetUserLayoutAllProfiles(final IPersonAttributes personAttributes) {
final IPerson person = PersonFactory.createRestrictedPerson();
person.setAttributes(personAttributes.getAttributes());
// get the integer uid into the person object without creating any new person data
int uid = userIdentityStore.getPortalUID(person, false);
person.setID(uid);
final Hashtable<Integer, UserProfile> map = userLayoutStore.getUserProfileList(person);
for (UserProfile profile : map.values()) {
resetUserLayoutForProfileByName(person, profile);
resetStylesheetUserPreferencesForProfile(person, profile);
}
}
use of org.apereo.portal.security.IPerson in project uPortal by Jasig.
the class ServerNameGuestChainingProfileMapperTest method testGuestNonAuthorizedDomainWithSubMapperMatching.
@Test
public void testGuestNonAuthorizedDomainWithSubMapperMatching() throws Exception {
ServerNameGuestChainingProfileMapper profileMapper = new ServerNameGuestChainingProfileMapper();
profileMapper.setAuthorizedServerNames(configMap);
List<IProfileMapper> subMappers = new ArrayList<>();
SessionAttributeProfileMapperImpl subMapper = new SessionAttributeProfileMapperImpl();
subMappers.add(subMapper);
subMapper.setDefaultProfileName("submapper_default");
subMapper.setAttributeName("session_attr");
Map<String, String> mapping = new HashMap<>();
mapping.put("session_attr", "sub_fname");
subMapper.setMappings(mapping);
profileMapper.setSubMappers(subMappers);
profileMapper.afterPropertiesSet();
final IPerson person = createGuestPerson();
final MockHttpServletRequest request = new MockHttpServletRequest();
request.setServerName("domain.test");
request.getSession().setAttribute("session_attr", "session_attr");
final String fname = profileMapper.getProfileFname(person, request);
Assert.assertEquals("guest-sub_fname", fname);
}
use of org.apereo.portal.security.IPerson in project uPortal by Jasig.
the class ServerNameGuestChainingProfileMapperTest method testGuestAuthorizedDomain.
@Test
public void testGuestAuthorizedDomain() throws Exception {
ServerNameGuestChainingProfileMapper profileMapper = new ServerNameGuestChainingProfileMapper();
profileMapper.setAuthorizedServerNames(configMap);
profileMapper.afterPropertiesSet();
final IPerson person = createGuestPerson();
final MockHttpServletRequest request = new MockHttpServletRequest();
request.setServerName("test-cfa.portail.ent");
final String fname = profileMapper.getProfileFname(person, request);
Assert.assertEquals("guest-cfa-default", fname);
}
use of org.apereo.portal.security.IPerson in project uPortal by Jasig.
the class ServerNameGuestChainingProfileMapperTest method testNonGuestNonAuthorizedDomain.
@Test
public void testNonGuestNonAuthorizedDomain() throws Exception {
ServerNameGuestChainingProfileMapper profileMapper = new ServerNameGuestChainingProfileMapper();
profileMapper.setAuthorizedServerNames(configMap);
profileMapper.afterPropertiesSet();
final IPerson person = createPerson();
final MockHttpServletRequest request = new MockHttpServletRequest();
request.setServerName("domain.test");
final String fname = profileMapper.getProfileFname(person, request);
Assert.assertEquals("default", fname);
}
Aggregations