Search in sources :

Example 1 with AdminAccountDetailsPageData

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);
}
Also used : AdminAccountDetailsPageData(teammates.ui.pagedata.AdminAccountDetailsPageData) AccountAttributes(teammates.common.datatransfer.attributes.AccountAttributes) CourseDetailsBundle(teammates.common.datatransfer.CourseDetailsBundle) EntityDoesNotExistException(teammates.common.exception.EntityDoesNotExistException) CourseAttributes(teammates.common.datatransfer.attributes.CourseAttributes)

Example 2 with AdminAccountDetailsPageData

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);
}
Also used : AdminAccountDetailsPageData(teammates.ui.pagedata.AdminAccountDetailsPageData) ShowPageResult(teammates.ui.controller.ShowPageResult) AdminAccountDetailsPageAction(teammates.ui.controller.AdminAccountDetailsPageAction) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes) Test(org.testng.annotations.Test)

Aggregations

AdminAccountDetailsPageData (teammates.ui.pagedata.AdminAccountDetailsPageData)2 Test (org.testng.annotations.Test)1 CourseDetailsBundle (teammates.common.datatransfer.CourseDetailsBundle)1 AccountAttributes (teammates.common.datatransfer.attributes.AccountAttributes)1 CourseAttributes (teammates.common.datatransfer.attributes.CourseAttributes)1 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)1 EntityDoesNotExistException (teammates.common.exception.EntityDoesNotExistException)1 AdminAccountDetailsPageAction (teammates.ui.controller.AdminAccountDetailsPageAction)1 ShowPageResult (teammates.ui.controller.ShowPageResult)1