use of org.apereo.portal.security.IPerson in project uPortal by Jasig.
the class PersonalizationFilterTest method setup.
@Before
public void setup() {
res = new MockHttpServletResponse();
req = new MockHttpServletRequest();
personalizationFilter = new PersonalizationFilter();
IPerson person = mockPerson("user1");
IPersonManager pMgr = mockPersonManager(req, person);
personalizationFilter.setPersonManager(pMgr);
}
use of org.apereo.portal.security.IPerson in project uPortal by Jasig.
the class PagsRESTControllerTest method testFindPagsGroup.
@Test
public void testFindPagsGroup() throws JsonProcessingException {
String groupName = "groupname";
IPerson person = new PersonImpl();
person.setUserName(USER_NAME);
person.setFullName("john doe");
Mockito.when(personManager.getPerson(req)).thenReturn(person);
IPersonAttributesGroupDefinition pagsGroup = new PersonAttributesGroupDefinitionImpl(groupName, "this is awesome");
Mockito.when(pagsService.getPagsDefinitionByName(person, groupName)).thenReturn(pagsGroup);
pagsRESTController.findPagsGroup(req, res, "groupname");
Mockito.verify(mapper).writeValueAsString(pagsGroup);
}
use of org.apereo.portal.security.IPerson in project uPortal by Jasig.
the class PeopleRESTControllerV50Test method testGetPerson.
@Test
public void testGetPerson() {
IPerson person = new PersonImpl();
person.setUserName(USER_NAME);
Mockito.when(personManager.getPerson(req)).thenReturn(person);
Mockito.when(lookupHelper.findPerson(person, USER_NAME)).thenReturn(getNamedPerson());
ModelAndView modelAndView = peopleRESTControllerV50.getPerson(USER_NAME, req, res);
Assert.assertEquals("json", modelAndView.getViewName());
Assert.assertNotNull(modelAndView.getModel());
}
use of org.apereo.portal.security.IPerson in project uPortal by Jasig.
the class PeopleRESTControllerV50Test method testMe.
@Test
public void testMe() {
IPerson person = new PersonImpl();
person.setUserName(USER_NAME);
Mockito.when(personManager.getPerson(req)).thenReturn(person);
Mockito.when(lookupHelper.findPerson(person, USER_NAME)).thenReturn(getNamedPerson());
ModelAndView modelAndView = peopleRESTControllerV50.getMe(req, res);
Assert.assertEquals("json", modelAndView.getViewName());
Assert.assertNotNull(modelAndView.getModel());
}
use of org.apereo.portal.security.IPerson in project uPortal by Jasig.
the class UserFilteringPortalEventHandler method supports.
@Override
public boolean supports(E event) {
if (!(event instanceof PortalEvent)) {
return false;
}
// Guest support check
final IPerson person = event.getPerson();
if (person != null && !this.supportGuest && person.isGuest()) {
return false;
}
// userName check
final String userName = event.getUserName();
if (this.supportedUserNames != null && this.supportedUserNames.contains(userName)) {
return true;
}
// ignored userName check
if (this.ignoredUserNames != null && this.ignoredUserNames.contains(userName)) {
return false;
}
// ignored userName pattern check
if (this.ignoredUserNamePatterns != null) {
for (final Pattern ignoredUserNamePattern : this.ignoredUserNamePatterns) {
if (ignoredUserNamePattern.matcher(userName).matches()) {
return false;
}
}
}
return this.supportedUserNames == null || this.supportedUserNames.isEmpty();
}
Aggregations