'Retrieve all repositories for which the current user has been granted administrative privileges.'

def build_initial_query(self, trans, **kwd):

    current_user = trans.user
    clause_list = []
    for ura in current_user.roles:
        clause_list.append((model.Role.table.c.id == ura.role_id))
    for uga in current_user.groups:
        group = uga.group
        for gra in group.roles:
            clause_list.append((model.Role.table.c.id == gra.role_id))
    return trans.sa_session.query(model.Repository).filter((model.Repository.table.c.deleted == false())).outerjoin(model.RepositoryRoleAssociation.table).outerjoin(model.Role.table).filter(or_(*clause_list)).join(model.User.table).outerjoin(model.RepositoryCategoryAssociation.table).outerjoin(model.Category.table)
