Commit 7ed60359 authored by Valentin Samir's avatar Valentin Samir
Browse files

[wiki/auth/theme] Un module pour choisir le themedu wiki en fonction du vhost

parent f986184e
# -*- coding: iso-8859-1 -*-
MoinMoin - CAS authentication
Jasig CAS (see authentication module.
@copyright: 2012 MoinMoin:RichardLiao
@license: GNU GPL, see COPYING for details.
import sys
import os
import time, re
import urlparse
import urllib, urllib2
from netaddr import IPNetwork, IPAddress
from werkzeug import get_host
from MoinMoin import log
logging = log.getLogger(__name__)
from MoinMoin.auth import BaseAuth, ContinueLogin
from MoinMoin import user, wikiutil
from MoinMoin.theme import load_theme_fallback
class ThemeVhost(BaseAuth):
name = 'ThemeVhost'
login_inputs = []
logout_possible = False
def __init__(self, theme_vhost={}):
def request(self, request, user_obj, **kw):
host = get_host(request.environ)
if not user_obj:
theme_name = self.theme_vhost.get(host, request.user.theme_name)
theme_name = self.theme_vhost.get(host, user_obj.theme_name)
load_theme_fallback(request, theme_name)
return user_obj, True
def login(self, request, user_obj, **kw):
return ContinueLogin(user_obj)
def logout(self, request, user_obj, **kw):
load_theme_fallback(request, request.cfg.theme_default)
return user_obj, True
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment