From fdb2675d8d6745e7dcb39aaf46cf8f058202a4a3 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Wed, 15 Jul 2020 09:24:00 +0200 Subject: [PATCH] Moinmoin mywiki conf --- roles/moinmoin/templates/moin/mywiki.py.j2 | 160 +++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 roles/moinmoin/templates/moin/mywiki.py.j2 diff --git a/roles/moinmoin/templates/moin/mywiki.py.j2 b/roles/moinmoin/templates/moin/mywiki.py.j2 new file mode 100644 index 00000000..ab1c68c3 --- /dev/null +++ b/roles/moinmoin/templates/moin/mywiki.py.j2 @@ -0,0 +1,160 @@ +# -*- coding: utf-8 -*- +{{ ansible_header | comment }} +# IMPORTANT! This encoding (charset) setting MUST be correct! If you live in a +# western country and you don't know that you use utf-8, you probably want to +# use iso-8859-1 (or some other iso charset). If you use utf-8 (a Unicode +# encoding) you MUST use: coding: utf-8 +# That setting must match the encoding your editor uses when you modify the +# settings below. If it does not, special non-ASCII chars will be wrong. + +""" +This is a sample config for a wiki that is part of a wiki farm and uses +farmconfig for common stuff. Here we define what has to be different from +the farm's common settings. +""" + +# we import the FarmConfig class for common defaults of our wikis: +from farmconfig import FarmConfig + +# now we subclass that config (inherit from it) and change what's different: +class Config(FarmConfig): + + # basic options (you normally need to change these) + sitename = u'Cr@ns Wiki' + interwikiname = 'CransWiki' + + # name of entry page / front page [Unicode], choose one of those: + + # a) if most wiki content is in a single language + #page_front_page = u"MyStartingPage" + + # b) if wiki content is maintained in many languages + page_front_page = u"PageAccueil" + + data_dir = '/var/local/wiki/data' + + # From here every parameters was added by the Crans -- + data_underlay_dir = '/var/local/wiki/underlay/' + + # The URL prefix we use to access the static stuff (img, css, js). + url_prefix_static = '/wiki' + + # UTF-8 encoding is the future + charset='utf-8' + + # Mailing + mail_from = u"Crans Wiki " + mail_smarthost='localhost' + + # This is checked by some rather critical and potentially harmful actions, + # like despam or PackageInstaller action: + superuser= [u"PeBecue", u"Wiki20-100", u"WikiB2moo", u"WikiBoudy", u"Benjamin", u"WikiPollion", u"Fardale", u"WikiErdnaxe"] + + # Custom logo + logo_string = u'Crans' + + # French by default + language_default = 'fr' + + # Advertise Wiki search to browser + html_head = '' + + theme_default = 'memodump' + stylesheets = [ + ('all', '/wiki/additional/css/boxes.css'), + ('all', '/wiki/additional/css/EventCalendar.css'), + ('all', '/wiki/additional/css/pagesPersos.css'), + ('all', '/wiki/additional/css/portal.css'), + ] + + solenoid_full_screen = False + solenoid_shadow = True + solenoid_userprefs = True + solenoid_theme_credit = False + + chart_options = {'width': 600, 'height': 300} + + refresh = (0, 'external') + + user_checkbox_defaults = {'edit_on_doubleclick': 0} + + show_rename_redirect = True + + # Catégories + page_category_regex = u'^Catégorie([A-Z][a-zàâéêèëîïôùû]+)+(/[A-Za-zàâéêèëîïôùû]+)*' + page_group_regex = u'^Groupe([A-Z][a-z]+)+' + + # Acls + acl_enabled=1 + allowed_actions = ['DeletePage', 'RenamePage', 'AttachFile'] + acl_rights_default = "GroupeAdmin:read,write,delete,revert,admin" + acl_rights_before = "GroupeNounous:read,write,admin,delete,revert" + acl_rights_after = "Trusted:read,write,revert Crans:read,write,revert Known:read Connexion:read All:" + + # Barre de navigation + navi_bar = [ + u"[[ModificationsRécentes|Modifications récentes]]", + u"[[RechercherUnePage|Rechercher]]", + u"[[SommaireDeL'Aide|Aide]]", + u"[[MentionsLégales|Mentions Légales]]" + ] + + # Lock + edit_locking = 'lock 10' + + # Surge + surge_action_limits = { + # allow max. requests per + #
secs action: (count, dt) + 'all': (30, 30), + 'default': (30, 60), + 'show': (30, 60), + 'recall': (10, 120), + 'raw': (20, 40), + 'diff': (30, 60), + 'fullsearch': (10, 120), + 'edit': (30, 300), + 'rss_rc': (30, 60), + 'AttachFile': (290, 60), + 'cache': (600, 30), + } + + surge_action_limits = None # disable surge protection + + surge_lockout_time = 0 # secs you get locked out when you ignore warnings + + show_timings = 0 + + traceback_log_dir = "/var/log/moin" + + # Import auth methods + import sys + sys.path.append('/var/local/wiki/data') + from plugin.auth import categorie_public, ip_range, cas, moin + + # Si la methode d'authentification est trusted + # les acl du pseudo groupe Trusted s'appliquent après authentification + # sinon se sont les acl de Known qui s'appliquent + auth_methods_trusted = ['moin', 'IpRange', 'CAS'] + + auth = [ + moin.MoinAuth(), + cas.CASAuth("https://cas.crans.org", + fallback_url='https://wiki.crans.org/', + ticket_path='/var/local/wiki/tickets/', + assoc_path='/var/local/wiki/assowiki/', + ), + ip_range.IpRange( + local_nets=['185.230.76.0/22', '10.53.0.0/16', '10.54.0.0/16', '2a0c:700:0::/40'], + actions=['newaccount'], + actions_msg={'newaccount':"La création de comptes n'est autorisée que depuis le réseau du Cr@ns ou sur zamok."}, + ), + categorie_public.PublicCategories(pub_cats=[u'Cat\xe9goriePagePublique']), # Avec trusted à False, les acl de Known s'appliquent + ] + + # Force text editor as CKEditor is broken + editor_force = True + + def ip_autorised_create_account(self,ip): + return ip.startswith('185.230.76.') or ip.startswith('185.230.77.') or ip.startswith('185.230.78.') or ip.startswith('185.230.79.') or ip.startswith('10.') or ip.startswith('2a0c:700:0:') +