Back to index

plone3  3.1.7
Functions
CMFPlone.Extensions.stripGRUFLocalRolePrefix Namespace Reference

Functions

def do
def removePrefix

Function Documentation

Do it!

Definition at line 5 of file stripGRUFLocalRolePrefix.py.

00005 
00006 def do(self): 
00007     """Do it!""" 
00008     print '---' 
00009     removePrefix(self) 
00010     # Reindex security settings recursively
00011     self.reindexObjectSecurity()
00012     print '---' 
00013     return 'Done!' 
     

Here is the call graph for this function:

Recursive function

Definition at line 14 of file stripGRUFLocalRolePrefix.py.

00014 
00015 def removePrefix(folder): 
00016     """Recursive function""" 
00017     for id in folder.objectIds(): 
00018         obj = folder._getOb(id) 
00019         local_roles = getattr(aq_base(obj), '__ac_local_roles__', None) 
00020 
00021         if local_roles is not None: 
00022             needs_updating = [(r, local_roles[r]) for r in local_roles \
00023                                                    if r.startswith('group_')] 
00024             old = local_roles 
00025             for name, roles in needs_updating: 
00026                 new_name = name[6:] 
00027                 del local_roles[name] 
00028                 local_roles[new_name] = roles 
00029 
00030             if needs_updating: 
00031                 print 'Updating: ', obj.getPhysicalPath() 
00032                 print 'Old: ', old 
00033                 obj.__ac_local_roles__ = local_roles 
00034                 print 'New: ', local_roles 
00035 
00036         if obj.objectIds(): 
00037             removePrefix(obj)

Here is the caller graph for this function: