Commit ec818907 authored by Jim Fulton's avatar Jim Fulton

Changed permission settings so that the undo form (list of

transactions) was covered by the "Undo changes" permission, rather
than by the "View management screens" permission.  Before it looked like
people could undo changes when they could merely see undo information.

Change so that undo information is not shown for transactions done by users
who were authenticated at a higher level.
parent 422a17d8
...@@ -85,8 +85,8 @@ ...@@ -85,8 +85,8 @@
__doc__='''short description __doc__='''short description
$Id: Undo.py,v 1.14 1999/05/18 15:40:21 jim Exp $''' $Id: Undo.py,v 1.15 1999/08/18 14:55:19 jim Exp $'''
__version__='$Revision: 1.14 $'[11:-2] __version__='$Revision: 1.15 $'[11:-2]
import Globals, ExtensionClass import Globals, ExtensionClass
from DateTime import DateTime from DateTime import DateTime
...@@ -97,8 +97,8 @@ class UndoSupport(ExtensionClass.Base): ...@@ -97,8 +97,8 @@ class UndoSupport(ExtensionClass.Base):
__ac_permissions__=( __ac_permissions__=(
('Undo changes', ( ('Undo changes', (
'manage_undo_transactions', 'undoable_transactions', 'manage_undo_transactions', 'undoable_transactions',
'manage_UndoForm',
)), )),
('View management screens', ('manage_UndoForm',)),
) )
manage_UndoForm=Globals.HTMLFile( manage_UndoForm=Globals.HTMLFile(
...@@ -142,37 +142,12 @@ class UndoSupport(ExtensionClass.Base): ...@@ -142,37 +142,12 @@ class UndoSupport(ExtensionClass.Base):
first_transaction+PrincipiaUndoBatchSize) first_transaction+PrincipiaUndoBatchSize)
db=self._p_jar.db db=self._p_jar.db
try: print 'path', path
r=db().undoLog(first_transaction, last_transaction) r=db().undoLog(first_transaction, last_transaction,
except: lambda d, p=path:
# BoboPOS2 find(d['user_name'], p)==0
r=[] )
add=r.append for d in r: d['time']=DateTime(d['time'])
h=['','']
try:
if Globals.Bobobase.has_key('_pack_time'):
since=Globals.Bobobase['_pack_time']
else: since=0
trans_info=db.transaction_info(
first_transaction,last_transaction,path,since=since)
except: trans_info=[]
for info in trans_info:
while len(info) < 4: info.append('')
t=info[1]
l=find(t,' ')
if l >= 0: t=t[l:]
add(
{'time': DateTime(atof(t)),
'id': "%s %s" % (info[1], info[0]),
'user_name': info[2],
'description': info[3],
})
else:
# ZODB 3
for d in r: d['time']=DateTime(d['time'])
return r return r
...@@ -181,17 +156,8 @@ class UndoSupport(ExtensionClass.Base): ...@@ -181,17 +156,8 @@ class UndoSupport(ExtensionClass.Base):
""" """
jar=self._p_jar jar=self._p_jar
db=jar.db db=jar.db
try: undo=db().undo undo=db().undo
except: for i in transaction_info: undo(i)
# BoboPOS 2
for i in transaction_info:
l=rfind(i,' ')
oids=db.Toops( (i[:l],), atoi(i[l:]))
jar.reload_oids(oids)
else:
# ZODB 3
for i in transaction_info: undo(i)
if REQUEST is None: return if REQUEST is None: return
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment