Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes
MoinMoin.security.Permissions Class Reference
Inheritance diagram for MoinMoin.security.Permissions:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def __init__
def save
def __getattr__

Public Attributes

 name
 request

Detailed Description

Basic interface for user permissions and system policy.

Note that you still need to allow some of the related actions, this
just controls their behavior, not their activation.

When sub classing this class, you must extend the class methods, not
replace them, or you might break the acl in the wiki. Correct sub
classing looks like this:

def read(self, pagename):
    # Your special security rule
    if something:
        return false

    # Do not return True or you break acl!
    # This call will use the default acl rules
    return Permissions.read(pagename)

Definition at line 97 of file __init__.py.


Constructor & Destructor Documentation

def MoinMoin.security.Permissions.__init__ (   self,
  user 
)

Definition at line 117 of file __init__.py.

00117 
00118     def __init__(self, user):
00119         self.name = user.name
00120         self.request = user._request


Member Function Documentation

def MoinMoin.security.Permissions.__getattr__ (   self,
  attr 
)
Shortcut to export getPermission function for all known ACL rights

if attr is one of the rights in acl_rights_valid, then return a
checking function for it. Else raise an AttributeError.

@param attr: one of ACL rights as defined in acl_rights_valid
@rtype: function
@return: checking function for that right, accepting a pagename

Definition at line 137 of file __init__.py.

00137 
00138     def __getattr__(self, attr):
00139         """ Shortcut to export getPermission function for all known ACL rights
00140 
00141         if attr is one of the rights in acl_rights_valid, then return a
00142         checking function for it. Else raise an AttributeError.
00143 
00144         @param attr: one of ACL rights as defined in acl_rights_valid
00145         @rtype: function
00146         @return: checking function for that right, accepting a pagename
00147         """
00148         request = self.request
00149         if attr not in request.cfg.acl_rights_valid:
00150             raise AttributeError, attr
00151         return lambda pagename: _check(self.request, pagename, self.name, attr)
00152 
00153 
# make an alias for the default policy

Here is the call graph for this function:

def MoinMoin.security.Permissions.save (   self,
  editor,
  newtext,
  rev,
  kw 
)
Check whether user may save a page.

`editor` is the PageEditor instance, the other arguments are
those of the `PageEditor.saveText` method.

@param editor: PageEditor instance.
@param newtext: new page text, you can enable of disable saving according
    to the content of the text, e.g. prevent link spam.
@param rev: new revision number? XXX
@param kw: XXX
@rtype: bool
@return: True if you can save or False

Reimplemented in MoinMoin.security.antispam.SecurityPolicy, and MoinMoin.security.autoadmin.SecurityPolicy.

Definition at line 121 of file __init__.py.

00121 
00122     def save(self, editor, newtext, rev, **kw):
00123         """ Check whether user may save a page.
00124 
00125         `editor` is the PageEditor instance, the other arguments are
00126         those of the `PageEditor.saveText` method.
00127 
00128         @param editor: PageEditor instance.
00129         @param newtext: new page text, you can enable of disable saving according
00130             to the content of the text, e.g. prevent link spam.
00131         @param rev: new revision number? XXX
00132         @param kw: XXX
00133         @rtype: bool
00134         @return: True if you can save or False
00135         """
00136         return self.write(editor.page_name)

Here is the caller graph for this function:


Member Data Documentation

Definition at line 118 of file __init__.py.

Definition at line 119 of file __init__.py.


The documentation for this class was generated from the following file: