Back to index

plone3  3.1.7
Public Member Functions | Public Attributes | Static Public Attributes | Private Member Functions | Static Private Attributes
PluggableAuthService.plugins.exportimport.ZODBUserManagerExportImport Class Reference
Inheritance diagram for PluggableAuthService.plugins.exportimport.ZODBUserManagerExportImport:
Inheritance graph
[legend]
Collaboration diagram for PluggableAuthService.plugins.exportimport.ZODBUserManagerExportImport:
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

Static Private Attributes

string _FILENAME = 'zodbusers.xml'
string _ROOT_TAGNAME = 'zodb-users'

Detailed Description

Adapter for dumping / loading ZODBUSerManager to an XML file.

Definition at line 141 of file exportimport.py.


Member Function Documentation

Definition at line 164 of file exportimport.py.

00164 
00165     def _getExportInfo(self):
00166         user_info = []
00167 
00168         for uinfo in self.context.listUserInfo():
00169             user_id = uinfo['user_id']
00170 
00171             info = {'user_id': user_id,
00172                     'login_name': uinfo['login_name'],
00173                     'password_hash': self.context._user_passwords[user_id],
00174                    }
00175 
00176             user_info.append(info)
00177 
00178         return {'title': self.context.title,
00179                 'users': user_info,
00180                }
00181 

Here is the caller graph for this function:

Definition at line 149 of file exportimport.py.

00149 
00150     def _purgeContext(self):
00151         self.context.__init__(self.context.id, self.context.title)

Here is the caller graph for this function:

Definition at line 152 of file exportimport.py.

00152 
00153     def _updateFromDOM(self, root):
00154         for user in root.getElementsByTagName('user'):
00155             user_id = self._getNodeAttr(user, 'user_id', None)
00156             login_name = self._getNodeAttr(user, 'login_name', None)
00157             password_hash = self._getNodeAttr(user, 'password_hash', None)
00158 
00159             if user_id is None or login_name is None or password_hash is None:
00160                 raise ValueError, 'Invalid user record'
00161 
00162             self.context.addUser(user_id, login_name, 'x')
00163             self.context._user_passwords[user_id] = password_hash

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 146 of file exportimport.py.

Definition at line 147 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: