コード例 #1
0
def manage_users(request, location):
    '''
    This view will return all CMS users who are editors for the specified course
    '''
    # check that logged in user has permissions to this item
    if not has_access(request.user, location,
                      role=INSTRUCTOR_ROLE_NAME) and not has_access(
                          request.user, location, role=STAFF_ROLE_NAME):
        raise PermissionDenied()

    course_module = modulestore().get_item(location)

    return render_to_response(
        'manage_users.html', {
            'active_tab':
            'users',
            'context_course':
            course_module,
            'staff':
            get_users_in_course_group_by_role(location, STAFF_ROLE_NAME),
            'add_user_postback_url':
            reverse('add_user', args=[location]).rstrip('/'),
            'remove_user_postback_url':
            reverse('remove_user', args=[location]).rstrip('/'),
            'allow_actions':
            has_access(request.user, location, role=INSTRUCTOR_ROLE_NAME),
            'request_user_id':
            request.user.id
        })
コード例 #2
0
def manage_users(request, location):
    '''
    This view will return all CMS users who are editors for the specified course
    '''
    # check that logged in user has permissions to this item
    if not has_access(request.user, location, role=INSTRUCTOR_ROLE_NAME) and not has_access(request.user, location, role=STAFF_ROLE_NAME):
        raise PermissionDenied()

    course_module = modulestore().get_item(location)

    return render_to_response('manage_users.html', {
        'context_course': course_module,
        'staff': get_users_in_course_group_by_role(location, STAFF_ROLE_NAME),
        'add_user_postback_url': reverse('add_user', args=[location]).rstrip('/'),
        'remove_user_postback_url': reverse('remove_user', args=[location]).rstrip('/'),
        'allow_actions': has_access(request.user, location, role=INSTRUCTOR_ROLE_NAME),
        'request_user_id': request.user.id
    })
コード例 #3
0
ファイル: user.py プロジェクト: NakarinTalikan/edx-platform
def manage_users(request, location):
    """
    This view will return all CMS users who are editors for the specified course
    """
    # check that logged in user has permissions to this item
    if not has_access(request.user, location, role=INSTRUCTOR_ROLE_NAME) and not has_access(
        request.user, location, role=STAFF_ROLE_NAME
    ):
        raise PermissionDenied()

    course_module = modulestore().get_item(location)

    return render_to_response(
        "manage_users.html",
        {
            "context_course": course_module,
            "staff": get_users_in_course_group_by_role(location, STAFF_ROLE_NAME),
            "add_user_postback_url": reverse("add_user", args=[location]).rstrip("/"),
            "remove_user_postback_url": reverse("remove_user", args=[location]).rstrip("/"),
            "allow_actions": has_access(request.user, location, role=INSTRUCTOR_ROLE_NAME),
            "request_user_id": request.user.id,
        },
    )