Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Static Private Attributes
PluggableAuthService.plugins.exportimport.ZODBGroupManagerExportImport Class Reference
Inheritance diagram for PluggableAuthService.plugins.exportimport.ZODBGroupManagerExportImport:
Inheritance graph
[legend]
Collaboration diagram for PluggableAuthService.plugins.exportimport.ZODBGroupManagerExportImport:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def export
def listExportableItems
def import_

Public Attributes

 context

Static Public Attributes

 encoding = None

Private Member Functions

def _purgeContext
def _updateFromDOM
def _getExportInfo
def _listGroupPrincipals

Static Private Attributes

string _FILENAME = 'zodbgroups.xml'
string _ROOT_TAGNAME = 'zodb-groups'

Detailed Description

Adapter for dumping / loading ZODBGroupManager to an XML file.

Definition at line 182 of file exportimport.py.


Member Function Documentation

Definition at line 204 of file exportimport.py.

00204 
00205     def _getExportInfo(self):
00206         group_info = []
00207         for ginfo in self.context.listGroupInfo():
00208             group_id = ginfo['id']
00209             info = {'group_id': group_id,
00210                     'title': ginfo['title'],
00211                     'description': ginfo['description'],
00212                    }
00213             info['principals'] = self._listGroupPrincipals(group_id) 
00214             group_info.append(info)
00215         return {'title': self.context.title,
00216                 'groups': group_info,
00217                }

Here is the call graph for this function:

Here is the caller graph for this function:

List the principal IDs of the group's members.

Definition at line 218 of file exportimport.py.

00218 
00219     def _listGroupPrincipals(self, group_id):
00220         """ List the principal IDs of the group's members.
00221         """
00222         result = []
00223         for k, v in self.context._principal_groups.items():
00224             if group_id in v:
00225                 result.append(k)
00226         return tuple(result)
00227 
00228 

Here is the caller graph for this function:

Definition at line 188 of file exportimport.py.

00188 
00189     def _purgeContext(self):
00190         self.context.__init__(self.context.id, self.context.title)

Here is the caller graph for this function:

Definition at line 191 of file exportimport.py.

00191 
00192     def _updateFromDOM(self, root):
00193 
00194         for group in root.getElementsByTagName('group'):
00195             group_id = self._getNodeAttr(group, 'group_id', None)
00196             title = self._getNodeAttr(group, 'title', None)
00197             description = self._getNodeAttr(group, 'description', None)
00198 
00199             self.context.addGroup(group_id, title, description)
00200 
00201             for principal in group.getElementsByTagName('principal'):
00202                 principal_id = self._getNodeAttr(principal, 'principal_id', None)
00203                 self.context.addPrincipalToGroup(principal_id, group_id)

Here is the call graph for this function:

Here is the caller graph for this function:

def PluggableAuthService.plugins.exportimport.SimpleXMLExportImport.export (   self,
  export_context,
  subdir,
  root = False 
) [inherited]
See IFilesystemExporter.

Definition at line 95 of file exportimport.py.

00095 
00096     def export(self, export_context, subdir, root=False):
00097         """ See IFilesystemExporter.
00098         """
00099         template = PageTemplateResource('xml/%s' % self._FILENAME,
00100                                         globals()).__of__(self.context)
00101         info = self._getExportInfo()
00102         export_context.writeDataFile('%s.xml' % self.context.getId(),
00103                                      template(info=info),
00104                                      'text/xml',
00105                                      subdir,
00106                                     )

Here is the call graph for this function:

def PluggableAuthService.plugins.exportimport.SimpleXMLExportImport.import_ (   self,
  import_context,
  subdir,
  root = False 
) [inherited]
See IFilesystemImporter

Definition at line 112 of file exportimport.py.

00112 
00113     def import_(self, import_context, subdir, root=False):
00114         """ See IFilesystemImporter
00115         """
00116         self.encoding = import_context.getEncoding()
00117 
00118         if import_context.shouldPurge():
00119             self._purgeContext()
00120 
00121         data = import_context.readDataFile('%s.xml' % self.context.getId(),
00122                                            subdir)
00123 
00124         if data is not None:
00125 
00126             dom = parseString(data)
00127             root = dom.firstChild
00128             assert root.tagName == self._ROOT_TAGNAME
00129 
00130             self.context.title = self._getNodeAttr(root, 'title', None)
00131             self._updateFromDOM(root)

Here is the call graph for this function:

See IFilesystemExporter.

Definition at line 107 of file exportimport.py.

00107 
00108     def listExportableItems(self):
00109         """ See IFilesystemExporter.
00110         """
00111         return ()


Member Data Documentation

Definition at line 185 of file exportimport.py.

Definition at line 186 of file exportimport.py.

Definition at line 93 of file exportimport.py.

Definition at line 90 of file exportimport.py.


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