1
# -*- coding: iso-8859-1 -*-
3
MoinMoin - Wiki Security Interface
5
This implements the basic interface for user permissions and
6
system policy. If you want to define your own policy, inherit
7
from the base class 'Permissions', so that when new permissions
8
are defined, you get the defaults.
10
Then assign your new class to "SecurityPolicy" in wikiconfig;
11
and I mean the class, not an instance of it!
13
@copyright: 2000-2004 by J�rgen Hermann <jh@web.de>
14
@license: GNU GPL, see COPYING for details.
17
#############################################################################
18
### Basic Permissions Interface -- most features enabled by default
19
#############################################################################
23
""" Basic interface for user permissions and system policy.
25
Note that you still need to allow some of the related actions, this
26
just controls their behaviour, not their activation.
29
def __init__(self, user):
30
""" Calculate the permissons `user` has.
32
from MoinMoin.Page import Page
35
self.request = user._request
37
def save(self, editor, newtext, rev, **kw):
38
""" Check whether user may save a page.
40
`editor` is the PageEditor instance, the other arguments are
41
those of the `PageEditor.saveText` method.
43
return self.write(editor.page_name)
45
def __getattr__(self, attr):
46
""" if attr is one of the rights in acl_rights_valid, then return a
47
checking function for it. Else raise an error.
49
request = self.request
51
if attr in request.cfg.acl_rights_valid:
52
return lambda pagename, Page=Page, request=request, attr=attr: Page(request, pagename).getACL(request).may(request, self.name, attr)
54
raise AttributeError, attr
57
# make an alias for the default policy