(cls, q, user=None)
return q
Modifies the sqlalchemy query `q` to only show projects accessible
        to `user`. If `user` is ``None``, only shows public projects.
Modifies the sqlalchemy query `q` to only show projects accessible
        to `user`. If `user` is ``None``, only shows public projects.
Modifies the sqlalchemy query q to only show projects accessible to user . If user is None only shows public projects .
def visible(cls, q, user=None):
        """
        Modifies the sqlalchemy query `q` to only show projects accessible
        to `user`. If `user` is ``None``, only shows public projects.
        """
        if user and user.in_group('admin'):
            # We don't do any filtering for admins,
            # who should have full visibility.
            pass
        elif user:
            # We only show the projects that are either public,
            # or are owned by `user`.
            q = q.filter(or_(
                Project.owner_id == user.id,
                Project.public == True
            ))
        else:
            q = q.filter(Project.public == True)

        return q
def visible ( cls , q , user = None ) : if user and user . in_group ( 'admin' ) : # We don't do any filtering for admins, # who should have full visibility. pass elif user : # We only show the projects that are either public, # or are owned by `user`. q = q . filter ( or_ ( Project . owner_id == user . id , Project . public == True ) ) else : q = q . filter ( Project . public == True ) return q