Search in sources :

Example 1 with PersonImpl

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

the class ParenTest method testIsApplicable.

public void testIsApplicable() {
    IPerson p = new PersonImpl();
    // Paren.Type.OR...
    Paren orParen = new Paren(Paren.Type.OR);
    orParen.addEvaluator(new AllUsersEvaluatorFactory());
    assertTrue("true should make true", orParen.isApplicable(p));
    orParen.addEvaluator(new NoUsersEvaluatorFactory());
    assertTrue("true + false should make true", orParen.isApplicable(p));
    orParen = new Paren(Paren.Type.OR);
    orParen.addEvaluator(new NoUsersEvaluatorFactory());
    assertFalse("false should make false", orParen.isApplicable(p));
    // Paren.Type.AND...
    Paren andParen = new Paren(Paren.Type.AND);
    andParen.addEvaluator(new AllUsersEvaluatorFactory());
    assertTrue("true should make true", andParen.isApplicable(p));
    andParen.addEvaluator(new NoUsersEvaluatorFactory());
    assertFalse("true + false should make false", andParen.isApplicable(p));
    // Paren.Type.NOT...
    Paren notParen = new Paren(Paren.Type.NOT);
    notParen.addEvaluator(new AllUsersEvaluatorFactory());
    assertFalse("true should make false", notParen.isApplicable(p));
    notParen = new Paren(Paren.Type.NOT);
    notParen.addEvaluator(new NoUsersEvaluatorFactory());
    assertTrue("false should make true", notParen.isApplicable(p));
}
Also used : IPerson(org.apereo.portal.security.IPerson) PersonImpl(org.apereo.portal.security.provider.PersonImpl)

Example 2 with PersonImpl

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

the class PAGSTest method getIPerson.

/** @return org.apereo.portal.groups.IEntity */
private IPerson getIPerson(String key) {
    IPerson ip = new PersonImpl();
    ip.setAttribute(IPerson.USERNAME, key);
    return ip;
}
Also used : IPerson(org.apereo.portal.security.IPerson) PersonImpl(org.apereo.portal.security.provider.PersonImpl)

Example 3 with PersonImpl

use of org.apereo.portal.security.provider.PersonImpl 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 4 with PersonImpl

use of org.apereo.portal.security.provider.PersonImpl 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 5 with PersonImpl

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

the class LayoutExporter method exportDataElement.

/* (non-Javadoc)
     * @see org.apereo.portal.io.xml.crn.AbstractDom4jExporter#exportDataElement(java.lang.String)
     */
@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);
    }
}
Also used : PersonImpl(org.apereo.portal.security.provider.PersonImpl) IUserProfile(org.apereo.portal.IUserProfile) Element(org.dom4j.Element) BrokenSecurityContext(org.apereo.portal.security.provider.BrokenSecurityContext)

Aggregations

PersonImpl (org.apereo.portal.security.provider.PersonImpl)16 IPerson (org.apereo.portal.security.IPerson)12 IUserProfile (org.apereo.portal.IUserProfile)4 BrokenSecurityContext (org.apereo.portal.security.provider.BrokenSecurityContext)4 ArrayList (java.util.ArrayList)2 AuthorizationException (org.apereo.portal.AuthorizationException)2 Tuple (org.apereo.portal.utils.Tuple)2 Before (org.junit.Before)2 Connection (java.sql.Connection)1 PreparedStatement (java.sql.PreparedStatement)1 ResultSet (java.sql.ResultSet)1 SQLException (java.sql.SQLException)1 Iterator (java.util.Iterator)1 LinkedHashSet (java.util.LinkedHashSet)1 UserProfile (org.apereo.portal.UserProfile)1 LocaleManager (org.apereo.portal.i18n.LocaleManager)1 IJoinQueryString (org.apereo.portal.jdbc.IJoinQueryString)1 PortletPreferenceImpl (org.apereo.portal.portlet.dao.jpa.PortletPreferenceImpl)1 IPortletDefinition (org.apereo.portal.portlet.om.IPortletDefinition)1 IPortletEntity (org.apereo.portal.portlet.om.IPortletEntity)1