use of teammates.ui.pagedata.AdminAccountDetailsPageData in project teammates by TEAMMATES.
the class AdminAccountDetailsPageAction method execute.
@Override
protected ActionResult execute() {
gateKeeper.verifyAdminPrivileges(account);
String googleId = getRequestParamValue(Const.ParamsNames.INSTRUCTOR_ID);
AccountAttributes accountInformation = logic.getAccount(googleId);
List<CourseDetailsBundle> instructorCourseList;
try {
instructorCourseList = new ArrayList<>(logic.getCourseSummariesForInstructor(googleId).values());
} catch (EntityDoesNotExistException e) {
// Not an instructor of any course
instructorCourseList = null;
}
List<CourseAttributes> studentCourseList;
try {
studentCourseList = logic.getCoursesForStudentAccount(googleId);
} catch (EntityDoesNotExistException e) {
// Not a student of any course
studentCourseList = null;
}
AdminAccountDetailsPageData data = new AdminAccountDetailsPageData(account, sessionToken, accountInformation, instructorCourseList, studentCourseList);
statusToAdmin = "adminAccountDetails Page Load<br>" + "Viewing details for " + data.getAccountInformation().name + "(" + googleId + ")";
return createShowPageResult(Const.ViewURIs.ADMIN_ACCOUNT_DETAILS, data);
}
use of teammates.ui.pagedata.AdminAccountDetailsPageData in project teammates by TEAMMATES.
the class AdminAccountDetailsPageActionTest method testExecuteAndPostProcess.
@Override
@Test
public void testExecuteAndPostProcess() {
______TS("case: view instructor account details");
InstructorAttributes instructor1OfCourse1 = typicalBundle.instructors.get("instructor1OfCourse1");
String[] submissionParams = new String[] { Const.ParamsNames.INSTRUCTOR_ID, instructor1OfCourse1.googleId };
final String adminUserId = "admin.user";
gaeSimulation.loginAsAdmin(adminUserId);
AdminAccountDetailsPageAction action = getAction(submissionParams);
ShowPageResult result = getShowPageResult(action);
assertEquals("", result.getStatusMessage());
assertEquals(getPageResultDestination(Const.ViewURIs.ADMIN_ACCOUNT_DETAILS, false, adminUserId), result.getDestinationWithParams());
assertFalse(result.isError);
AdminAccountDetailsPageData data = (AdminAccountDetailsPageData) result.data;
assertEquals(instructor1OfCourse1.googleId, data.getAccountInformation().googleId);
}
Aggregations