[wiki-lenny] Déproxyfication du www

darcs-hash:20081211174714-bd074-326d72d8640cad6ee785ee108fe022121da1b390.gz
This commit is contained in:
Antoine Durand-Gasselin 2008-12-11 18:47:14 +01:00
parent ac5047c2f3
commit 26fef18d0f
2 changed files with 12 additions and 12 deletions

View file

@ -1174,7 +1174,7 @@ class RequestBase(object):
def initTheme(self):
""" Set theme - forced theme, user theme or wiki default """
### HACK SAUVAGE 1/1
if self.remote_addr == '138.231.136.67':
if self.http_host == 'www.crans.org':
theme_name = 'crans-www'
elif self.cfg.theme_force:
### FIN HACK 1/1

View file

@ -24,11 +24,11 @@ import re
from MoinMoin import wikiutil, user
from MoinMoin.Page import Page
#### HACK SAUVAGE 1/5
### HACK SAUVAGE 1/5
import sys
sys.path.append('/usr/scripts/gestion/')
from iptools import is_crans
#### FIN DU HACK 1/5
### FIN HACK 1/5
#############################################################################
### Basic Permissions Interface -- most features enabled by default
@ -254,9 +254,9 @@ class AccessControlList:
'''
#special_users = ["All", "Known", "Trusted"] # order is important
## HACK SAUVAGE 2/5
### HACK SAUVAGE 2/5
special_users = ["All", "Known", "Trusted", "Crans", "NoCrans"] # order is important
## FIN HACK 2/5
### FIN HACK 2/5
def __init__(self, cfg, lines=[]):
"""Initialize an ACL, starting from <nothing>.
@ -347,10 +347,10 @@ class AccessControlList:
return acl_lines
def _special_All(self, request, name, dowhat, rightsdict):
## HACK SAUVAGE 3/5
### HACK SAUVAGE 3/5
if dowhat == "read" and is_page_public(request):
return True
## FIN HACK 3/5
### FIN HACK 3/5
return rightsdict.get(dowhat)
def _special_Known(self, request, name, dowhat, rightsdict):
@ -373,10 +373,10 @@ class AccessControlList:
return rightsdict.get(dowhat)
return None
#### HACK SAUVAGE 4/5
### HACK SAUVAGE 4/5
def _requete_interne(self, request):
try:
if is_crans(request.remote_addr) and (request.remote_addr != u'138.231.136.3' or is_crans(request.mpyreq.headers_in['X-Forwarded-For'].split(",")[-1].strip())):
if is_crans(request.remote_addr):
return True
except:
pass
@ -394,7 +394,7 @@ class AccessControlList:
if not self._requete_interne(request):
return rightsdict.get(dowhat)
return None
#### FIN Du HACK 4/5
### FIN HACK 4/5
def __eq__(self, other):
return self.acl_lines == other.acl_lines
@ -488,7 +488,7 @@ def parseACL(request, text):
acl_lines = [args for verb, args in pi if verb == 'acl']
return AccessControlList(request.cfg, acl_lines)
#### HACK SAUVAGE 5/5
### HACK SAUVAGE 5/5
def is_page_public(request):
#return True
## On recherche si la page est publique
@ -498,4 +498,4 @@ def is_page_public(request):
return True
else:
return None
#### FIn DU HACK 5/5
### FIN HACK 5/5