diff --git a/wiki-lenny/share/request.__init__.py b/wiki-lenny/share/request.__init__.py index 43c59778..46198855 100644 --- a/wiki-lenny/share/request.__init__.py +++ b/wiki-lenny/share/request.__init__.py @@ -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 diff --git a/wiki-lenny/share/security.__init__.py b/wiki-lenny/share/security.__init__.py index 4efb6844..38882c79 100644 --- a/wiki-lenny/share/security.__init__.py +++ b/wiki-lenny/share/security.__init__.py @@ -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 . @@ -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