# Path: web/util.py
# REALM = 'Snowball'
# def auth(req, realm, name, password):
# def assert_string(name, value, max_length):
# def check_tags(tag_arg):
# def check_datetime(datetime_arg):
# def assert_direction(direction):
# def check_weight(weight):
# def error_handler(func):
#     def func_replacement(self, *args, **kwargs):
# def get_dynamic_setting(db, name):
# def save_dynamic_setting(db, name, value):
#     def __init__(self, *args, **kwargs):
# class SnowballHandler(OzHandler):


from web import *
from web import util
from web.serialization import *
from oz.handler import *
import model
# Copyright 2009 Yusuf Simonson
# This file is part of Snowball.
#
# Snowball is free software: you can redistribute it and/or modify it under the
# terms of the GNU Affero General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# Snowball is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Snowball.  If not, see <http://www.gnu.org/licenses/>.


REALM = 'Administrator Control Panel'

def admin_auth(req, realm, name, password):
    if realm != REALM or name != 'admin': return False
    return password == req.settings['admin_pass']


# Path: web/util.py
# REALM = 'Snowball'
# def auth(req, realm, name, password):
# def assert_string(name, value, max_length):
# def check_tags(tag_arg):
# def check_datetime(datetime_arg):
# def assert_direction(direction):
# def check_weight(weight):
# def error_handler(func):
#     def func_replacement(self, *args, **kwargs):
# def get_dynamic_setting(db, name):
# def save_dynamic_setting(db, name, value):
#     def __init__(self, *args, **kwargs):
# class SnowballHandler(OzHandler):


# Path: web/admin/admin.py
from web import *
from web import util
from web.serialization import *
from oz.handler import *
import model

# Copyright 2009 Yusuf Simonson
# This file is part of Snowball.
#
# Snowball is free software: you can redistribute it and/or modify it under the
# terms of the GNU Affero General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option) any
# later version.
#
# Snowball is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License
# along with Snowball.  If not, see <http://www.gnu.org/licenses/>.


REALM = 'Administrator Control Panel'

def admin_auth(req, realm, name, password):
    if realm != REALM or name != 'admin': return False
    return password == req.settings['admin_pass']


class AdminHandler(util.SnowballHandler):