Exemple #1
0
def masquerade_as_group_member(user, course, partition_id, group_id):
    """
    Installs a masquerade for the specified user and course, to enable
    the user to masquerade as belonging to the specific partition/group
    combination.

    Arguments:
        user (User): a user.
        course (CourseDescriptor): a course.
        partition_id (int): the integer partition id, referring to partitions already
           configured in the course.
        group_id (int); the integer group id, within the specified partition.

    Returns: the status code for the AJAX response to update the user's masquerade for
        the specified course.
    """
    request = _create_mock_json_request(user,
                                        data={
                                            "role": "student",
                                            "user_partition_id": partition_id,
                                            "group_id": group_id
                                        })
    response = MasqueradeView.as_view()(request, six.text_type(course.id))
    setup_masquerade(request, course.id, True)
    return response.status_code
Exemple #2
0
    # Teams endpoints
    urlpatterns += [
        url(r'^api/team/', include('lms.djangoapps.teams.api_urls')),
        url(
            r'^courses/{}/teams/'.format(settings.COURSE_ID_PATTERN, ),
            include('lms.djangoapps.teams.urls'),
            name='teams_endpoints',
        ),
    ]

# allow course staff to change to student view of courseware
if settings.FEATURES.get('ENABLE_MASQUERADE'):
    urlpatterns += [
        url(
            r'^courses/{}/masquerade$'.format(settings.COURSE_KEY_PATTERN, ),
            MasqueradeView.as_view(),
            name='masquerade_update',
        ),
    ]

urlpatterns += [
    url(
        r'^courses/{}/generate_user_cert'.format(settings.COURSE_ID_PATTERN, ),
        courseware_views.generate_user_cert,
        name='generate_user_cert',
    ),
]

# discussion forums live within courseware, so courseware must be enabled first
if settings.FEATURES.get('ENABLE_DISCUSSION_SERVICE'):
    urlpatterns += [