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))
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)
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)
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)))))
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)
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)
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)
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))
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 ])
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)
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))
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)
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)
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)
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) ) )) )
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)
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))
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))
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) ) ) ) )
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)
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)
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)
def get_forks(auth, node, **kwargs): fork_list = node.forks.sort('-forked_date') return _render_nodes(nodes=fork_list, auth=auth)
def get_registrations(auth, **kwargs): node_to_use = kwargs['node'] or kwargs['project'] registrations = node_to_use.node__registrations return _render_nodes(registrations, auth)
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)
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)
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)
def get_forks(auth, node, **kwargs): return _render_nodes(nodes=node.forks, auth=auth)
def get_registrations(auth, node, **kwargs): registrations = node.node__registrations return _render_nodes(registrations, auth)
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)
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)