Back to index

plone3  3.1.7
Public Member Functions | Static Public Attributes | Static Private Attributes
CMFCore.UndoTool.UndoTool Class Reference
Inheritance diagram for CMFCore.UndoTool.UndoTool:
Inheritance graph
[legend]
Collaboration diagram for CMFCore.UndoTool.UndoTool:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def listUndoableTransactionsFor
def undo

Static Public Attributes

string id = 'portal_undo'
string meta_type = 'CMF Undo Tool'
tuple security = ClassSecurityInfo()
tuple manage_options
tuple manage_overview = DTMLFile( 'explainUndoTool', _dtmldir )

Static Private Attributes

tuple __implements__ = (z2IUndoTool, )

Detailed Description

This tool is used to undo changes.

Definition at line 36 of file UndoTool.py.


Member Function Documentation

def CMFCore.UndoTool.UndoTool.listUndoableTransactionsFor (   self,
  object,
  first_transaction = None,
  last_transaction = None,
  PrincipiaUndoBatchSize = None 
)
List all transaction IDs the user is allowed to undo on 'object'.

Definition at line 67 of file UndoTool.py.

00067 
00068                                     PrincipiaUndoBatchSize=None):
00069         """ List all transaction IDs the user is allowed to undo on 'object'.
00070         """
00071         transactions = object.undoable_transactions(
00072             first_transaction=first_transaction,
00073             last_transaction=last_transaction,
00074             PrincipiaUndoBatchSize=PrincipiaUndoBatchSize)
00075         for t in transactions:
00076             # Ensure transaction ids don't have embedded LF.
00077             t['id'] = t['id'].replace('\n', '')
00078         if not _checkPermission(ManagePortal, object):
00079             # Filter out transactions done by other members of the portal.
00080             user_id = _getAuthenticatedUser(self).getId()
00081             transactions = filter(
00082                 lambda record, user_id=user_id:
00083                 record['user_name'].split()[-1] == user_id,
00084                 transactions
00085                 )
00086         return transactions

Here is the call graph for this function:

Here is the caller graph for this function:

def CMFCore.UndoTool.UndoTool.undo (   self,
  object,
  transaction_info 
)
    Undo the list of transactions passed in 'transaction_info',
    first verifying that the current user is allowed to undo them.

Definition at line 88 of file UndoTool.py.

00088 
00089     def undo(self, object, transaction_info):
00090         """
00091             Undo the list of transactions passed in 'transaction_info',
00092             first verifying that the current user is allowed to undo them.
00093         """
00094         # Belt and suspenders:  make sure that the user is actually
00095         # allowed to undo the transation(s) in transaction_info.
00096 
00097         xids = {}  # set of allowed transaction IDs
00098 
00099         allowed = self.listUndoableTransactionsFor( object )
00100 
00101         for xid in map( lambda x: x['id'], allowed ):
00102             xids[xid] = 1
00103 
00104         if type( transaction_info ) == type( '' ):
00105             transaction_info = [ transaction_info ]
00106 
00107         for tinfo in transaction_info:
00108             if not xids.get( tinfo, None ):
00109                 raise AccessControl_Unauthorized
00110 
00111         object.manage_undo_transactions(transaction_info)
00112 
00113 InitializeClass(UndoTool)
00114 registerToolInterface('portal_undo', IUndoTool)

Here is the call graph for this function:


Member Data Documentation

tuple CMFCore.UndoTool.UndoTool.__implements__ = (z2IUndoTool, ) [static, private]

Definition at line 42 of file UndoTool.py.

string CMFCore.UndoTool.UndoTool.id = 'portal_undo' [static]

Definition at line 44 of file UndoTool.py.

Initial value:
( SimpleItem.manage_options
                     + ({'label': 'Overview',
                         'action': 'manage_overview'},)
                     )

Definition at line 49 of file UndoTool.py.

tuple CMFCore.UndoTool.UndoTool.manage_overview = DTMLFile( 'explainUndoTool', _dtmldir ) [static]

Definition at line 58 of file UndoTool.py.

string CMFCore.UndoTool.UndoTool.meta_type = 'CMF Undo Tool' [static]

Definition at line 45 of file UndoTool.py.

tuple CMFCore.UndoTool.UndoTool.security = ClassSecurityInfo() [static]

Definition at line 47 of file UndoTool.py.


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