Beispiel #1
0
def membership_list_all(request, project_short_name):
    
    # load project
    project = get_object_or_404(Project, short_name__iexact=project_short_name)
    
    # check permission
    if not userHasAdminPermission(request.user, project):
        return HttpResponseForbidden(PERMISSION_DENIED_MESSAGE)
    
    # load all users - that match...
    match = getQueryDict(request).get('match', None) # works for GET or POST
    if match:
        users = getUsersThatMatch(match)
    else:
        users = User.objects.all().order_by('last_name')  
                  
    title = 'Assign Project Members From "List Of All Node Users"'
    view_name = 'membership_list_all'
    return render_membership_page(request, project, users, title, view_name)
Beispiel #2
0
def membership_list_enrolled(request, project_short_name):
    
    # load project
    project = get_object_or_404(Project, short_name__iexact=project_short_name)
    
    # check permission
    if not userHasAdminPermission(request.user, project):
        return HttpResponseForbidden(PERMISSION_DENIED_MESSAGE)
    
    # optional 'match' argument
    match = getQueryDict(request).get('match', None) # works for GET or POST
    
    if match:
        # filter all users by 'match'
        _users = getUsersThatMatch(match)
        # filter all users by project
        users = [user for user in _users if (user in project.getUserGroup().user_set.all() 
                                             or user in project.getAdminGroup().user_set.all())]     
    else:
        users = list(project.getUsers())
    
    title = '%s Current Users' % project.short_name
    view_name = 'membership_list_enrolled'
    return render_membership_page(request, project, users, title, view_name)