예제 #1
0
def get_public_projects(uid=None, user=None):
    user = user or User.load(uid)
    # In future redesign, should be limited for users with many projects / components
    nodes = Node.find_for_user(user,
                               subquery=(TOP_LEVEL_PROJECT_QUERY
                                         & Q('is_public', 'eq', True)))
    return _render_nodes(list(nodes))
예제 #2
0
파일: node.py 프로젝트: WenTingZhu/osf.io
def get_forks(auth, **kwargs):
    node_to_use = kwargs['node'] or kwargs['project']
    forks = node_to_use.node__forked.find(
        Q('is_deleted', 'eq', False) &
        Q('is_registration', 'eq', False)
    )
    return _render_nodes(forks, auth)
예제 #3
0
파일: node.py 프로젝트: akrit19/osf.io
def get_forks(auth, **kwargs):
    node_to_use = kwargs['node'] or kwargs['project']
    forks = node_to_use.node__forked.find(
        Q('is_deleted', 'eq', False) &
        Q('is_registration', 'eq', False)
    )
    return _render_nodes(forks, auth)
예제 #4
0
def get_registrations(auth, node, **kwargs):
    # get all undeleted registrations, including archiving
    sorted_registrations = node.registrations_all.sort('-registered_date')
    undeleted_registrations = [
        n for n in sorted_registrations if not n.is_deleted
    ]
    return _render_nodes(undeleted_registrations, auth)
예제 #5
0
def get_public_projects(uid=None, user=None):
    user = user or User.load(uid)
    return _render_nodes(
        list(
            user.node__contributed.find(
                (Q('category', 'eq', 'project') & Q('is_public', 'eq', True)
                 & Q('is_registration', 'eq', False)
                 & Q('is_deleted', 'eq', False)))))
예제 #6
0
파일: node.py 프로젝트: Alpani/osf.io
def get_children(auth, node, **kwargs):
    user = auth.user
    if request.args.get("permissions"):
        perm = request.args["permissions"].lower().strip()
        nodes = [each for each in node.nodes if perm in each.get_permissions(user) and not each.is_deleted]
    else:
        nodes = [each for each in node.nodes if not each.is_deleted]
    return _render_nodes(nodes, auth)
예제 #7
0
파일: views.py 프로젝트: cwisecarver/osf.io
def get_public_components(uid=None, user=None):
    user = user or User.load(uid)
    # TODO: This should use User.visible_contributor_to?
    # In future redesign, should be limited for users with many projects / components
    nodes = list(
        Node.find_for_user(user, subquery=(PROJECT_QUERY & Q("parent_node", "ne", None) & Q("is_public", "eq", True)))
    )
    return _render_nodes(nodes, show_path=True)
예제 #8
0
def get_public_components(uid=None, user=None):
    user = user or User.load(uid)
    # TODO: This should use User.visible_contributor_to?
    nodes = list(
        user.node__contributed.find(
            (Q('category', 'ne', 'project') & Q('is_public', 'eq', True)
             & Q('is_registration', 'eq', False)
             & Q('is_deleted', 'eq', False))))
    return _render_nodes(nodes, show_path=True)
예제 #9
0
def get_public_projects(uid=None, user=None):
    user = user or User.load(uid)

    nodes = Node.find_for_user(
        user,
        subquery=(Q('category', 'eq', 'project') & Q('is_public', 'eq', True)
                  & Q('is_registration', 'eq', False)
                  & Q('is_deleted', 'eq', False)))
    return _render_nodes(list(nodes))
예제 #10
0
파일: views.py 프로젝트: Doris1989/osf.io
def get_public_components(uid=None, user=None):
    user = user or User.load(uid)
    return _render_nodes([
        node
        for node in user.node__contributed
        if node.category != 'project'
        and node.is_public
        and not node.is_registration
        and not node.is_deleted
    ])
예제 #11
0
파일: views.py 프로젝트: lbanner/osf.io
def get_public_components(uid=None, user=None):
    user = user or User.load(uid)
    return _render_nodes([
        node
        for node in user.node__contributed
        if node.category != 'project'
        and node.is_public
        and not node.is_registration
        and not node.is_deleted
    ])
예제 #12
0
def get_public_components(uid=None, user=None):
    user = user or User.load(uid)
    # TODO: This should use User.visible_contributor_to?
    # In future redesign, should be limited for users with many projects / components
    nodes = list(
        Node.find_for_user(
            user,
            subquery=(PROJECT_QUERY & Q('parent_node', 'ne', None)
                      & Q('is_public', 'eq', True))))
    return _render_nodes(nodes, show_path=True)
예제 #13
0
파일: views.py 프로젝트: fredtoh/osf.io
def get_public_projects(uid=None, user=None):
    user = user or User.load(uid)
    # In future redesign, should be limited for users with many projects / components
    nodes = Node.find_for_user(
        user,
        subquery=(
            TOP_LEVEL_PROJECT_QUERY &
            Q('is_public', 'eq', True)
        )
    )
    return _render_nodes(list(nodes))
예제 #14
0
파일: node.py 프로젝트: mattspitzer/osf.io
def get_children(auth, node, **kwargs):
    user = auth.user
    if request.args.get('permissions'):
        perm = request.args['permissions'].lower().strip()
        nodes = [
            each for each in node.nodes
            if perm in each.get_permissions(user) and not each.is_deleted
        ]
    else:
        nodes = [each for each in node.nodes if not each.is_deleted]
    return _render_nodes(nodes, auth)
예제 #15
0
def get_children(auth, **kwargs):
    user = auth.user
    node_to_use = kwargs['node'] or kwargs['project']
    if request.args.get('permissions'):
        perm = request.args['permissions'].lower().strip()
        nodes = [
            node for node in node_to_use.nodes
            if perm in node.get_permissions(user) and not node.is_deleted
        ]
    else:
        nodes = [node for node in node_to_use.nodes if not node.is_deleted]
    return _render_nodes(nodes, auth)
예제 #16
0
파일: views.py 프로젝트: GageGaskins/osf.io
def get_public_components(uid=None, user=None):
    user = user or User.load(uid)
    # TODO: This should use User.visible_contributor_to?
    nodes = list(user.node__contributed.find(
        (
            Q('category', 'ne', 'project') &
            Q('is_public', 'eq', True) &
            Q('is_registration', 'eq', False) &
            Q('is_deleted', 'eq', False)
        )
    ))
    return _render_nodes(nodes, show_path=True)
예제 #17
0
파일: views.py 프로젝트: GageGaskins/osf.io
def get_public_projects(uid=None, user=None):
    user = user or User.load(uid)
    return _render_nodes(
        list(user.node__contributed.find(
            (
                Q('category', 'eq', 'project') &
                Q('is_public', 'eq', True) &
                Q('is_registration', 'eq', False) &
                Q('is_deleted', 'eq', False)
            )
        ))
    )
예제 #18
0
파일: node.py 프로젝트: akrit19/osf.io
def get_children(auth, **kwargs):
    user = auth.user
    node_to_use = kwargs['node'] or kwargs['project']
    if request.args.get('permissions'):
        perm = request.args['permissions'].lower().strip()
        nodes = [node for node in node_to_use.nodes if perm in node.get_permissions(user) and not node.is_deleted]
    else:
        nodes = [
            node
            for node in node_to_use.nodes
            if not node.is_deleted
        ]
    return _render_nodes(nodes, auth)
예제 #19
0
파일: views.py 프로젝트: KAsante95/osf.io
def get_public_projects(uid=None, user=None):
    user = user or User.load(uid)

    nodes = Node.find_for_user(
        user,
        subquery=(
            Q("category", "eq", "project")
            & Q("is_public", "eq", True)
            & Q("is_registration", "eq", False)
            & Q("is_deleted", "eq", False)
        ),
    )
    return _render_nodes(list(nodes))
예제 #20
0
def get_public_projects(uid=None, user=None):
    user = user or User.load(uid)

    nodes = Node.find_for_user(
        user,
        subquery=(
            Q('category', 'eq', 'project') &
            Q('is_public', 'eq', True) &
            Q('is_registration', 'eq', False) &
            Q('is_deleted', 'eq', False)
        )
    )
    return _render_nodes(list(nodes))
예제 #21
0
파일: views.py 프로젝트: bdyetton/osf.io
def get_public_projects(uid=None, user=None):
    user = user or User.load(uid)
    return _render_nodes(
        list(
            user.node__contributed.find(
                (
                    Q("category", "eq", "project")
                    & Q("is_public", "eq", True)
                    & Q("is_registration", "eq", False)
                    & Q("is_deleted", "eq", False)
                )
            )
        )
    )
예제 #22
0
파일: views.py 프로젝트: bdyetton/osf.io
def get_public_components(uid=None, user=None):
    user = user or User.load(uid)
    # TODO: This should use User.visible_contributor_to?
    nodes = list(
        user.node__contributed.find(
            (
                Q("category", "ne", "project")
                & Q("is_public", "eq", True)
                & Q("is_registration", "eq", False)
                & Q("is_deleted", "eq", False)
            )
        )
    )
    return _render_nodes(nodes, show_path=True)
예제 #23
0
파일: node.py 프로젝트: vinod676/osf.io
def get_readable_descendants(auth, node, **kwargs):
    descendants = []
    for child in node.nodes:
        if request.args.get('permissions'):
            perm = request.args['permissions'].lower().strip()
            if perm not in child.get_permissions(auth.user):
                continue
        if child.is_deleted:
            continue
        elif child.can_view(auth):
            descendants.append(child)
        elif not child.primary:
            if node.has_permission(auth.user, 'write'):
                descendants.append(child)
            continue
        else:
            for descendant in child.find_readable_descendants(auth):
                descendants.append(descendant)
    return _render_nodes(descendants, auth)
예제 #24
0
def get_readable_descendants(auth, node, **kwargs):
    descendants = []
    for child in node.nodes:
        if request.args.get('permissions'):
            perm = request.args['permissions'].lower().strip()
            if perm not in child.get_permissions(auth.user):
                continue
        if child.is_deleted:
            continue
        elif child.can_view(auth):
            descendants.append(child)
        elif not child.primary:
            if node.has_permission(auth.user, 'write'):
                descendants.append(child)
            continue
        else:
            for descendant in child.find_readable_descendants(auth):
                descendants.append(descendant)
    return _render_nodes(descendants, auth)
예제 #25
0
파일: node.py 프로젝트: erinmayhood/osf.io
def get_forks(auth, node, **kwargs):
    forks = node.node__forked.find(
        Q('is_deleted', 'eq', False) & Q('is_registration', 'eq', False))
    return _render_nodes(forks, auth)
예제 #26
0
파일: node.py 프로젝트: 545zhou/osf.io
def get_forks(auth, node, **kwargs):
    fork_list = node.forks.sort('-forked_date')
    return _render_nodes(nodes=fork_list, auth=auth)
예제 #27
0
파일: node.py 프로젝트: akrit19/osf.io
def get_registrations(auth, **kwargs):
    node_to_use = kwargs['node'] or kwargs['project']
    registrations = node_to_use.node__registrations
    return _render_nodes(registrations, auth)
예제 #28
0
파일: node.py 프로젝트: erinmayhood/osf.io
def get_forks(auth, node, **kwargs):
    forks = node.node__forked.find(
        Q('is_deleted', 'eq', False) &
        Q('is_registration', 'eq', False)
    )
    return _render_nodes(forks, auth)
예제 #29
0
파일: node.py 프로젝트: mattspitzer/osf.io
def get_registrations(auth, node, **kwargs):
    registrations = [
        n for n in reversed(node.node__registrations) if not n.is_deleted
    ]  # get all registrations, including archiving
    return _render_nodes(registrations, auth)
예제 #30
0
파일: node.py 프로젝트: mattspitzer/osf.io
def get_forks(auth, node, **kwargs):
    fork_list = sorted(node.forks,
                       key=lambda fork: fork.forked_date,
                       reverse=True)
    return _render_nodes(nodes=fork_list, auth=auth)
예제 #31
0
def get_forks(auth, node, **kwargs):
    return _render_nodes(nodes=node.forks, auth=auth)
예제 #32
0
파일: node.py 프로젝트: erinmayhood/osf.io
def get_registrations(auth, node, **kwargs):
    registrations = node.node__registrations
    return _render_nodes(registrations, auth)
예제 #33
0
파일: node.py 프로젝트: 545zhou/osf.io
def get_registrations(auth, node, **kwargs):
    # get all undeleted registrations, including archiving
    sorted_registrations = node.registrations_all.sort('-registered_date')
    undeleted_registrations = [n for n in sorted_registrations if not n.is_deleted]
    return _render_nodes(undeleted_registrations, auth)
예제 #34
0
파일: node.py 프로젝트: GageGaskins/osf.io
def get_forks(auth, node, **kwargs):
    return _render_nodes(nodes=node.forks, auth=auth)
예제 #35
0
파일: node.py 프로젝트: rmoorman/osf.io
def get_registrations(auth, node, **kwargs):
    registrations = [n for n in reversed(node.node__registrations) if not n.is_deleted]  # get all registrations, including archiving
    return _render_nodes(registrations, auth)
예제 #36
0
파일: node.py 프로젝트: rmoorman/osf.io
def get_forks(auth, node, **kwargs):
    fork_list = sorted(node.forks, key=lambda fork: fork.forked_date, reverse=True)
    return _render_nodes(nodes=fork_list, auth=auth)
예제 #37
0
파일: node.py 프로젝트: WenTingZhu/osf.io
def get_registrations(auth, **kwargs):
    node_to_use = kwargs['node'] or kwargs['project']
    registrations = node_to_use.node__registrations
    return _render_nodes(registrations, auth)
예제 #38
0
파일: node.py 프로젝트: GageGaskins/osf.io
def get_registrations(auth, node, **kwargs):
    registrations = node.node__registrations
    return _render_nodes(registrations, auth)
예제 #39
0
def get_forks(auth, node, **kwargs):
    fork_list = node.forks.sort('-forked_date')
    return _render_nodes(nodes=fork_list, auth=auth)