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));
}
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;
}
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;
}
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;
}
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);
}
}
Aggregations