<?xml version="1.0" encoding="utf-8"?><!DOCTYPE article  PUBLIC '-//OASIS//DTD DocBook XML V4.4//EN'  'http://www.docbook.org/xml/4.4/docbookx.dtd'><article><articleinfo><title>HelpOnConfiguration/SecurityPolicy</title></articleinfo><para><code>SecurityPolicy</code> is a config option that allows wiki admins to dynamically enable or disable certain key actions in a <ulink url="https://wiki.hcoop.net/HelpOnConfiguration/SecurityPolicy/MoinMoin#">MoinMoin</ulink> wiki, most notably editing and deleting content. See also <ulink url="https://wiki.hcoop.net/HelpOnConfiguration/SecurityPolicy/HelpOnAccessControlLists#">HelpOnAccessControlLists</ulink> for an easier way. </para><section><title>Mechanics</title><para>Security restrictions in a <ulink url="https://wiki.hcoop.net/HelpOnConfiguration/SecurityPolicy/MoinMoin#">MoinMoin</ulink> wiki work by the interface defined in the <code>MoinMoin.security</code> module. The <code>Permissions</code> class implements the basic interface for user permissions and system policy. If you want to define your own policy, inherit from that base class, so that when new permissions are defined, you get the defaults. </para><para>Then either assign your new class to <code>Config.SecurityPolicy</code> in <code>wikiconfig.py</code> (and I mean the class, not an instance of it), or define your class as a member of <code>class Config</code> in <code>wikiconfig.py</code> and name it <code>SecurityPolicy</code>. </para></section><section><title>Anti-Spam protection</title><para>If you enable the &quot;antispam&quot; utility your wiki will fetch the page <ulink url="http://moinmaster.wikiwikiweb.de/BadContent#">BadContent</ulink> and keep automatically in sync with the original version. Do not edit it, because your edits will be overwritten. </para><para>Add this at the beginning of your wikiconfig: </para><screen><![CDATA[from MoinMoin.security.antispam import SecurityPolicy]]></screen></section><section><title>SSL-only Write</title><para>If you want for security reasons that users do not edit the wiki without using SSL you should add: </para><screen><![CDATA[# add this at the of your config settings:
from MoinMoin.security import Permissions
]]><![CDATA[
   # add this later , careful with indentation
   # make wiki only writeable via SSL
    class SecurityPolicy(Permissions):
        def write(self, pagename):
                return (self.request.is_ssl
                        and Permissions.write(self, pagename)]]></screen></section><section><title>Samples</title><para>For samples on using this mechanism, see <ulink url="http://moinmoin.wikiwikiweb.de/SecurityPolicy#">SecurityPolicy</ulink>. </para></section><section><title>See also</title><itemizedlist><listitem><para><ulink url="https://wiki.hcoop.net/HelpOnConfiguration/SecurityPolicy/HelpOnAutoAdmin#">HelpOnAutoAdmin</ulink> when you want to give some users or user groups admin rights on some pages. </para></listitem></itemizedlist></section></article>