# Path: raggregate/queries/users.py
# def get_user_by_id(id):
# def get_user_by_name(name):
# def get_user_by_email(email):
# def get_user_by_token(token):
# def is_user_allowed_admin_action(user_id, target_id, request = None, target_class = 'user_post',):
# def get_followed_users(id):
# def get_user_votes(user_id, vote_type, submission_id=None):
# def create_temp_user(initial_pw = None):
# def fuzzify_date(d):
# def create_user(**kwargs):
# def login_user(request, u, password, bypass_password = False):
# def add_user_picture(orig_filename, new_prefix, up_dir, image_file):
# def send_email_to_user(request, to_email, title, body):
# def send_lost_password_verify_email(request, user):
# def generate_new_password(request, user):


from raggregate.queries import users
from pyramid.security import Everyone
from pyramid.security import Authenticated

class AuthPolicy(object):
    def authenticated_userid(self, request):
        if not request.session['users.id']:
            return None

# Path: raggregate/queries/users.py
# def get_user_by_id(id):
# def get_user_by_name(name):
# def get_user_by_email(email):
# def get_user_by_token(token):
# def is_user_allowed_admin_action(user_id, target_id, request = None, target_class = 'user_post',):
# def get_followed_users(id):
# def get_user_votes(user_id, vote_type, submission_id=None):
# def create_temp_user(initial_pw = None):
# def fuzzify_date(d):
# def create_user(**kwargs):
# def login_user(request, u, password, bypass_password = False):
# def add_user_picture(orig_filename, new_prefix, up_dir, image_file):
# def send_email_to_user(request, to_email, title, body):
# def send_lost_password_verify_email(request, user):
# def generate_new_password(request, user):


# Path: raggregate/db_auth.py
from raggregate.queries import users
from pyramid.security import Everyone
from pyramid.security import Authenticated


class AuthPolicy(object):
    def authenticated_userid(self, request):
        if not request.session['users.id']:
            return None

        return users.get_user_by_id(request.session['users.id'])