-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfindLastModifiedUser.py
36 lines (27 loc) · 1022 Bytes
/
findLastModifiedUser.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from AccessControl.SecurityManagement import newSecurityManager
from DateTime import DateTime
from Products.CMFCore.utils import getToolByName
from Testing.makerequest import makerequest
from zope.app.component.hooks import setSite
app = makerequest(app)
app._p_jar.sync()
site=app['Plone']
setSite(site)
admin = app.acl_users.getUserById('admin')
admin = admin.__of__(app.acl_users)
newSecurityManager(None, admin)
portal_catalog = getToolByName(site, "portal_catalog")
pr = getToolByName(site, "portal_repository")
now = DateTime()
results = portal_catalog.searchResults({'modified' : {'query' : now - 1, 'range' : 'min'}})
for r in results:
o = r.getObject()
history = pr.getHistoryMetadata(o)
if history:
revisions = history.getLength(countPurged=False)
vdatafull = history.retrieve(revisions-1, countPurged=False)
vdata = vdatafull['metadata']
modifier = vdata['sys_metadata']['principal']
print o.absolute_url()
print modifier
print "\n"