use of org.mifos.security.util.ActivityContext in project head by mifos.
the class AddActivityIntegrationTest method upgradeAndCheck.
private Upgrade upgradeAndCheck() throws IOException, SQLException, ApplicationException {
// Connection connection = session.connection();
// connection.setAutoCommit(true);
short newId = 17032;
AddActivity upgrade = new AddActivity(newId, SecurityConstants.LOAN_MANAGEMENT, "Can use the executive washroom");
upgrade.upgrade(session.connection());
session = StaticHibernateUtil.getSessionTL();
ActivityEntity fetched = (ActivityEntity) session.get(ActivityEntity.class, newId);
Assert.assertEquals("Can use the executive washroom", fetched.getActivityName());
Assert.assertEquals(SecurityConstants.LOAN_MANAGEMENT, (short) fetched.getParent().getId());
ActivityContext activityContext = new ActivityContext(newId, TestObjectFactory.HEAD_OFFICE);
UserContext admin = TestUtils.makeUser(RolesAndPermissionConstants.ADMIN_ROLE);
Assert.assertTrue(legacyRolesPermissionsDao.isActivityAllowed(admin, activityContext));
UserContext nonAdmin = TestUtils.makeUser(TestUtils.DUMMY_ROLE);
Assert.assertFalse(legacyRolesPermissionsDao.isActivityAllowed(nonAdmin, activityContext));
return upgrade;
}
use of org.mifos.security.util.ActivityContext in project head by mifos.
the class LoanPrdActionStrutsTest method setUp.
@Before
public void setUp() throws Exception {
userContext = TestObjectFactory.getContext();
request.getSession().setAttribute(Constants.USERCONTEXT, userContext);
addRequestParameter("recordLoanOfficerId", "1");
addRequestParameter("recordOfficeId", "1");
ActivityContext ac = TestObjectFactory.getActivityContext();
request.getSession(false).setAttribute("ActivityContext", ac);
flowKey = createFlow(request, LoanPrdAction.class);
}
use of org.mifos.security.util.ActivityContext in project head by mifos.
the class NotesActionStrutsTest method setUp.
@Before
public void setUp() throws Exception {
userContext = TestUtils.makeUser();
request.getSession().setAttribute(Constants.USERCONTEXT, userContext);
addRequestParameter("recordLoanOfficerId", "1");
addRequestParameter("recordOfficeId", "1");
ActivityContext ac = new ActivityContext((short) 0, userContext.getBranchId().shortValue(), userContext.getId().shortValue());
request.getSession(false).setAttribute("ActivityContext", ac);
request.getSession().setAttribute(Constants.USERCONTEXT, userContext);
flowKey = createFlow(request, NotesAction.class);
addRequestParameter(Constants.CURRENTFLOWKEY, flowKey);
request.setAttribute(Constants.CURRENTFLOWKEY, flowKey);
}
use of org.mifos.security.util.ActivityContext in project head by mifos.
the class AdminActionStrutsTest method setUp.
@Before
public void setUp() throws Exception {
userContext = TestUtils.makeUser();
request.getSession().setAttribute(Constants.USERCONTEXT, userContext);
addRequestParameter("recordLoanOfficerId", "1");
addRequestParameter("recordOfficeId", "1");
ActivityContext ac = new ActivityContext((short) 0, userContext.getBranchId().shortValue(), userContext.getId().shortValue());
request.getSession(false).setAttribute("ActivityContext", ac);
request.getSession().setAttribute(Constants.USERCONTEXT, userContext);
}
use of org.mifos.security.util.ActivityContext in project head by mifos.
the class CheckListActionStrutsTest method setUp.
@Before
public void setUp() throws Exception {
UserContext userContext = TestUtils.makeUser();
request.getSession().setAttribute(Constants.USERCONTEXT, userContext);
addRequestParameter("recordLoanOfficerId", "1");
addRequestParameter("recordOfficeId", "1");
ActivityContext ac = new ActivityContext((short) 0, userContext.getBranchId(), userContext.getId());
request.getSession(false).setAttribute("ActivityContext", ac);
flowKey = createFlow(request, ChkListAction.class);
}
Aggregations