Search in sources :

Example 21 with IPerson

use of org.apereo.portal.security.IPerson in project uPortal by Jasig.

the class PAGSTest method testStringEqualsIgnoreCaseTester.

public void testStringEqualsIgnoreCaseTester() throws Exception {
    print(CR + "***** ENTERING PAGSTester.testStringEqualsIgnoreCaseTester() *****" + CR);
    String msg = null;
    msg = "Creating a new IPerson";
    print(msg);
    IPerson newPerson = getIPerson("de3");
    assertNotNull(msg, newPerson);
    print("Adding attributes to IPerson.");
    newPerson.setAttribute(key1, randomStrings[0]);
    newPerson.setAttribute(key2, randomStrings[1].toLowerCase());
    msg = "Testing IPerson " + newPerson;
    print(msg);
    String testKey = randomStrings[0].toLowerCase();
    IPersonTester tester1 = new StringEqualsIgnoreCaseTester(new TestPersonAttributesGroupTestDefinition(key1, testKey));
    IPersonTester tester2 = new StringEqualsIgnoreCaseTester(new TestPersonAttributesGroupTestDefinition(key2, randomStrings[1]));
    msg = "Testing " + tester1;
    assertTrue(msg, tester1.test(newPerson));
    msg = "Testing " + tester2;
    assertTrue(msg, tester2.test(newPerson));
    print("Success!");
    print(CR + "***** LEAVING PAGSTester.testStringEqualsIgnoreCaseTester() *****" + CR);
}
Also used : IPerson(org.apereo.portal.security.IPerson) StringEqualsIgnoreCaseTester(org.apereo.portal.groups.pags.testers.StringEqualsIgnoreCaseTester)

Example 22 with IPerson

use of org.apereo.portal.security.IPerson in project uPortal by Jasig.

the class GuestUserTesterTest method createPerson.

protected static IPerson createPerson() throws Exception {
    IPerson person = new PersonImpl();
    person.setAttribute(IPerson.USERNAME, "non_guest");
    return person;
}
Also used : IPerson(org.apereo.portal.security.IPerson) PersonImpl(org.apereo.portal.security.provider.PersonImpl)

Example 23 with IPerson

use of org.apereo.portal.security.IPerson in project uPortal by Jasig.

the class GuestUserTesterTest method createGuestPerson.

protected static IPerson createGuestPerson() throws Exception {
    IPerson person = new PersonImpl();
    person.setAttribute(IPerson.USERNAME, "guest");
    return person;
}
Also used : IPerson(org.apereo.portal.security.IPerson) PersonImpl(org.apereo.portal.security.provider.PersonImpl)

Example 24 with IPerson

use of org.apereo.portal.security.IPerson in project uPortal by Jasig.

the class StylesheetUserPreferencesServiceImpl method getStylesheetPreferencesKey.

protected final StylesheetPreferencesKey getStylesheetPreferencesKey(HttpServletRequest request, PreferencesScope prefScope) {
    final IUserInstance userInstance = this.userInstanceManager.getUserInstance(request);
    final IPerson person = userInstance.getPerson();
    final IUserPreferencesManager preferencesManager = userInstance.getPreferencesManager();
    final IUserProfile userProfile = preferencesManager.getUserProfile();
    final IStylesheetDescriptor stylesheetDescriptor = getStylesheetDescriptor(request, prefScope);
    return new StylesheetPreferencesKey(person, userProfile, stylesheetDescriptor);
}
Also used : IUserInstance(org.apereo.portal.user.IUserInstance) IPerson(org.apereo.portal.security.IPerson) IUserProfile(org.apereo.portal.IUserProfile) IStylesheetDescriptor(org.apereo.portal.layout.om.IStylesheetDescriptor) IUserPreferencesManager(org.apereo.portal.IUserPreferencesManager)

Example 25 with IPerson

use of org.apereo.portal.security.IPerson in project uPortal by Jasig.

the class PortletMarketplaceController method getLayoutInfo.

@ResourceMapping("layoutInfo")
public String getLayoutInfo(ResourceRequest request, @RequestParam String portletFName, Model model) throws TransformerException {
    Validate.notNull(portletFName, "Please supply a portlet fname");
    final HttpServletRequest servletRequest = this.portalRequestUtils.getPortletHttpRequest(request);
    IUserInstance ui = userInstanceManager.getUserInstance(servletRequest);
    UserPreferencesManager upm = (UserPreferencesManager) ui.getPreferencesManager();
    IUserLayoutManager ulm = upm.getUserLayoutManager();
    IPerson person = ui.getPerson();
    DistributedUserLayout userLayout = userLayoutStore.getUserLayout(person, upm.getUserProfile());
    List<PortletTab> tabs = getPortletTabInfo(userLayout, portletFName);
    boolean isFavorite = isPortletFavorited(ulm.getUserLayout(), portletFName);
    model.addAttribute("favorite", isFavorite);
    model.addAttribute("tabs", tabs);
    return "json";
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) IUserInstance(org.apereo.portal.user.IUserInstance) IPerson(org.apereo.portal.security.IPerson) DistributedUserLayout(org.apereo.portal.layout.dlm.DistributedUserLayout) IUserLayoutManager(org.apereo.portal.layout.IUserLayoutManager) UserPreferencesManager(org.apereo.portal.UserPreferencesManager) ResourceMapping(org.springframework.web.portlet.bind.annotation.ResourceMapping)

Aggregations

IPerson (org.apereo.portal.security.IPerson)177 Test (org.junit.Test)46 PersonImpl (org.apereo.portal.security.provider.PersonImpl)41 ModelAndView (org.springframework.web.servlet.ModelAndView)41 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)33 HttpServletRequest (javax.servlet.http.HttpServletRequest)26 IUserInstance (org.apereo.portal.user.IUserInstance)26 ArrayList (java.util.ArrayList)22 IAuthorizationPrincipal (org.apereo.portal.security.IAuthorizationPrincipal)22 HashMap (java.util.HashMap)20 IPersonAttributes (org.apereo.services.persondir.IPersonAttributes)16 EntityIdentifier (org.apereo.portal.EntityIdentifier)15 HttpSession (javax.servlet.http.HttpSession)14 IPortletDefinition (org.apereo.portal.portlet.om.IPortletDefinition)14 PortalException (org.apereo.portal.PortalException)11 IUserLayoutManager (org.apereo.portal.layout.IUserLayoutManager)11 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)11 List (java.util.List)10 IUserProfile (org.apereo.portal.IUserProfile)9 ISecurityContext (org.apereo.portal.security.ISecurityContext)9